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 VM_CODE_OBSERVERS_H_ | 5 #ifndef VM_CODE_OBSERVERS_H_ |
6 #define VM_CODE_OBSERVERS_H_ | 6 #define VM_CODE_OBSERVERS_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/allocation.h" | |
9 | 10 |
10 namespace dart { | 11 namespace dart { |
11 | 12 |
12 // Object observing code creation events. Used by external profilers and | 13 // Object observing code creation events. Used by external profilers and |
13 // debuggers to map address ranges to function names. | 14 // debuggers to map address ranges to function names. |
14 class CodeObserver { | 15 class CodeObserver { |
15 public: | 16 public: |
siva
2012/12/14 19:13:40
CodeObserver() { }
Max Heinritz (Google)
2012/12/14 19:59:47
Done. Should I use virtual?
| |
16 virtual ~CodeObserver() { } | 17 virtual ~CodeObserver() { } |
17 | 18 |
18 // Returns true if this observer is active and should be notified | 19 // Returns true if this observer is active and should be notified |
19 // about newly created code objects. | 20 // about newly created code objects. |
20 virtual bool IsActive() const = 0; | 21 virtual bool IsActive() const = 0; |
21 | 22 |
22 // Notify code observer about a newly created code object with the | 23 // Notify code observer about a newly created code object with the |
23 // given properties. | 24 // given properties. |
24 virtual void Notify(const char* name, | 25 virtual void Notify(const char* name, |
25 uword base, | 26 uword base, |
26 uword prologue_offset, | 27 uword prologue_offset, |
27 uword size, | 28 uword size, |
28 bool optimized) = 0; | 29 bool optimized) = 0; |
siva
2012/12/14 19:13:40
Please add
private:
DISALLOW_COPY_AND_ASSIGN(Cod
Max Heinritz (Google)
2012/12/14 19:59:47
Done.
| |
29 }; | 30 }; |
30 | 31 |
31 | 32 |
32 class CodeObservers { | 33 class CodeObservers : public AllStatic { |
33 public: | 34 public: |
34 static void InitOnce(); | 35 static void InitOnce(); |
35 | 36 |
36 static void Register(CodeObserver* observer); | 37 static void Register(CodeObserver* observer); |
37 | 38 |
38 // Notify all active code observers about a newly created code object. | 39 // Notify all active code observers about a newly created code object. |
39 static void NotifyAll(const char* name, | 40 static void NotifyAll(const char* name, |
40 uword base, | 41 uword base, |
41 uword prologue_offset, | 42 uword prologue_offset, |
42 uword size, | 43 uword size, |
43 bool optimized); | 44 bool optimized); |
44 | 45 |
45 // Returns true if there is at least one active code observer. | 46 // Returns true if there is at least one active code observer. |
46 static bool AreActive(); | 47 static bool AreActive(); |
47 | 48 |
49 static void DeleteAll(); | |
50 | |
48 private: | 51 private: |
49 static intptr_t observers_length_; | 52 static intptr_t observers_length_; |
50 static CodeObserver** observers_; | 53 static CodeObserver** observers_; |
51 }; | 54 }; |
52 | 55 |
53 | 56 |
54 } // namespace dart | 57 } // namespace dart |
55 | 58 |
56 #endif // VM_CODE_OBSERVERS_H_ | 59 #endif // VM_CODE_OBSERVERS_H_ |
OLD | NEW |