blob: 9412eae9a19b3d407f439e4d0632391abe7982a3 [file] [log] [blame]
Richard Uhlerf629cfd2016-12-12 13:11:26 +00001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.ahat.heapdump;
18
19/**
20 * Generic PlaceHolder instance to take the place of a real AhatInstance for
21 * the purposes of displaying diffs.
22 *
23 * This should be created through a call to AhatInstance.newPlaceHolder();
24 */
25public class AhatPlaceHolderInstance extends AhatInstance {
26 AhatPlaceHolderInstance(AhatInstance baseline) {
27 super(-1);
28 setBaseline(baseline);
29 baseline.setBaseline(this);
30 }
31
32 @Override public long getSize() {
33 return 0;
34 }
35
36 @Override public long getRetainedSize(AhatHeap heap) {
37 return 0;
38 }
39
40 @Override public long getTotalRetainedSize() {
41 return 0;
42 }
43
44 @Override public AhatHeap getHeap() {
45 return getBaseline().getHeap().getBaseline();
46 }
47
48 @Override public String getClassName() {
49 return getBaseline().getClassName();
50 }
51
52 @Override public String asString(int maxChars) {
53 return getBaseline().asString(maxChars);
54 }
55
56 @Override public String toString() {
57 return getBaseline().toString();
58 }
59
60 @Override public boolean isPlaceHolder() {
61 return true;
62 }
63}