• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package com.android.ahat.heapdump;
18 
19 /**
20  * PlaceHolder instance to take the place of a real AhatClassObj for
21  * the purposes of displaying diffs.
22  *
23  * This should be created through a call to newPlaceHolder();
24  */
25 public class AhatPlaceHolderClassObj extends AhatClassObj {
AhatPlaceHolderClassObj(AhatClassObj baseline)26   AhatPlaceHolderClassObj(AhatClassObj baseline) {
27     super(-1);
28     setBaseline(baseline);
29     baseline.setBaseline(this);
30   }
31 
getSize()32   @Override public Size getSize() {
33     return Size.ZERO;
34   }
35 
getRetainedSize(AhatHeap heap)36   @Override public Size getRetainedSize(AhatHeap heap) {
37     return Size.ZERO;
38   }
39 
getTotalRetainedSize()40   @Override public Size getTotalRetainedSize() {
41     return Size.ZERO;
42   }
43 
getHeap()44   @Override public AhatHeap getHeap() {
45     return getBaseline().getHeap().getBaseline();
46   }
47 
getClassName()48   @Override public String getClassName() {
49     return getBaseline().getClassName();
50   }
51 
toString()52   @Override public String toString() {
53     return getBaseline().toString();
54   }
55 
isPlaceHolder()56   @Override public boolean isPlaceHolder() {
57     return true;
58   }
59 
getName()60   @Override public String getName() {
61     return getBaseline().asClassObj().getName();
62   }
63 
getSuperClassObj()64   @Override public AhatClassObj getSuperClassObj() {
65     return getBaseline().asClassObj().getSuperClassObj().getBaseline().asClassObj();
66   }
67 
getClassLoader()68   @Override public AhatInstance getClassLoader() {
69     return getBaseline().asClassObj().getClassLoader().getBaseline();
70   }
71 }
72