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 // For ostream. 21 #include <ostream> 22 // For uint32_t. 23 #include <stdint.h> 24 // For size_t. 25 #include <stdlib.h> 26 27 #include "base/macros.h" 28 29 namespace art { 30 namespace mirror { 31 class Class; 32 class Object; 33 template<class MirrorType> class HeapReference; 34 class Reference; 35 } // namespace mirror 36 class StackVisitor; 37 38 // A callback for visiting an object in the heap. 39 typedef void (ObjectCallback)(mirror::Object* obj, void* arg); 40 // A callback used for marking an object, returns the new address of the object if the object moved. 41 typedef mirror::Object* (MarkObjectCallback)(mirror::Object* obj, void* arg) WARN_UNUSED; 42 43 typedef void (MarkHeapReferenceCallback)(mirror::HeapReference<mirror::Object>* ref, void* arg); 44 typedef void (DelayReferenceReferentCallback)(mirror::Class* klass, mirror::Reference* ref, 45 void* arg); 46 47 // A callback for testing if an object is marked, returns null if not marked, otherwise the new 48 // address the object (if the object didn't move, returns the object input parameter). 49 typedef mirror::Object* (IsMarkedCallback)(mirror::Object* object, void* arg) WARN_UNUSED; 50 51 // Returns true if the object in the heap reference is marked, if it is marked and has moved the 52 // callback updates the heap reference contain the new value. 53 typedef bool (IsHeapReferenceMarkedCallback)(mirror::HeapReference<mirror::Object>* object, 54 void* arg) WARN_UNUSED; 55 typedef void (ProcessMarkStackCallback)(void* arg); 56 57 } // namespace art 58 59 #endif // ART_RUNTIME_OBJECT_CALLBACKS_H_ 60