OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_CODE_OBSERVERS_H_ | 5 #ifndef RUNTIME_VM_CODE_OBSERVERS_H_ |
6 #define RUNTIME_VM_CODE_OBSERVERS_H_ | 6 #define RUNTIME_VM_CODE_OBSERVERS_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 #ifndef PRODUCT | 13 #ifndef PRODUCT |
14 | 14 |
15 class Mutex; | 15 class Mutex; |
16 | 16 |
17 // Object observing code creation events. Used by external profilers and | 17 // Object observing code creation events. Used by external profilers and |
18 // debuggers to map address ranges to function names. | 18 // debuggers to map address ranges to function names. |
19 class CodeObserver { | 19 class CodeObserver { |
20 public: | 20 public: |
21 CodeObserver() { } | 21 CodeObserver() {} |
22 | 22 |
23 virtual ~CodeObserver() { } | 23 virtual ~CodeObserver() {} |
24 | 24 |
25 // Returns true if this observer is active and should be notified | 25 // Returns true if this observer is active and should be notified |
26 // about newly created code objects. | 26 // about newly created code objects. |
27 virtual bool IsActive() const = 0; | 27 virtual bool IsActive() const = 0; |
28 | 28 |
29 // Notify code observer about a newly created code object with the | 29 // Notify code observer about a newly created code object with the |
30 // given properties. | 30 // given properties. |
31 virtual void Notify(const char* name, | 31 virtual void Notify(const char* name, |
32 uword base, | 32 uword base, |
33 uword prologue_offset, | 33 uword prologue_offset, |
(...skipping 16 matching lines...) Expand all Loading... |
50 uword base, | 50 uword base, |
51 uword prologue_offset, | 51 uword prologue_offset, |
52 uword size, | 52 uword size, |
53 bool optimized); | 53 bool optimized); |
54 | 54 |
55 // Returns true if there is at least one active code observer. | 55 // Returns true if there is at least one active code observer. |
56 static bool AreActive(); | 56 static bool AreActive(); |
57 | 57 |
58 static void DeleteAll(); | 58 static void DeleteAll(); |
59 | 59 |
60 static Mutex* mutex() { | 60 static Mutex* mutex() { return mutex_; } |
61 return mutex_; | |
62 } | |
63 | 61 |
64 private: | 62 private: |
65 static Mutex* mutex_; | 63 static Mutex* mutex_; |
66 static intptr_t observers_length_; | 64 static intptr_t observers_length_; |
67 static CodeObserver** observers_; | 65 static CodeObserver** observers_; |
68 }; | 66 }; |
69 | 67 |
70 #endif // !PRODUCT | 68 #endif // !PRODUCT |
71 | 69 |
72 } // namespace dart | 70 } // namespace dart |
73 | 71 |
74 #endif // RUNTIME_VM_CODE_OBSERVERS_H_ | 72 #endif // RUNTIME_VM_CODE_OBSERVERS_H_ |
OLD | NEW |