OSDN Git Service

Revert "Prune uses library classes even without profile DO NOT MERGE"
[android-x86/art.git] / runtime / object_callbacks.h
1 /*
2  * Copyright (C) 2013 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 #ifndef ART_RUNTIME_OBJECT_CALLBACKS_H_
18 #define ART_RUNTIME_OBJECT_CALLBACKS_H_
19
20 #include "base/macros.h"
21
22 namespace art {
23 namespace mirror {
24   class Object;
25   template<class MirrorType> class HeapReference;
26 }  // namespace mirror
27
28 // A callback for visiting an object in the heap.
29 typedef void (ObjectCallback)(mirror::Object* obj, void* arg);
30
31 class IsMarkedVisitor {
32  public:
33   virtual ~IsMarkedVisitor() {}
34   // Return null if an object is not marked, otherwise returns the new address of that object.
35   // May return the same address as the input if the object did not move.
36   virtual mirror::Object* IsMarked(mirror::Object* obj) = 0;
37 };
38
39 class MarkObjectVisitor {
40  public:
41   virtual ~MarkObjectVisitor() {}
42   // Mark an object and return the new address of an object.
43   // May return the same address as the input if the object did not move.
44   virtual mirror::Object* MarkObject(mirror::Object* obj) = 0;
45   // Mark an object and update the value stored in the heap reference if the object moved.
46   virtual void MarkHeapReference(mirror::HeapReference<mirror::Object>* obj) = 0;
47 };
48
49 }  // namespace art
50
51 #endif  // ART_RUNTIME_OBJECT_CALLBACKS_H_