Index: runtime/vm/dart.h |
diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h |
index 585cdddf982a15b9212ca2381fc0dc8d96ec6159..6344f501faf4898f642c61ad4a3508c6fd83b621 100644 |
--- a/runtime/vm/dart.h |
+++ b/runtime/vm/dart.h |
@@ -16,6 +16,25 @@ class Isolate; |
class RawError; |
class ThreadPool; |
+// Object observing code creation events. Used by external profilers and |
+// debuggers to map address ranges to function names. |
+class CodeObserver { |
Ivan Posva
2012/11/27 09:11:20
I am not certain whether this belongs into this fi
Vyacheslav Egorov (Google)
2012/11/27 16:26:12
Moved all code observers related code to a separat
|
+ public: |
+ virtual ~CodeObserver() { } |
+ |
+ // Returns true if this observer is active and should be notified |
+ // about newly created code objects. |
+ virtual bool IsActive() const = 0; |
+ |
+ // Notify code observer about newly created code object with the |
Ivan Posva
2012/11/27 09:11:20
about a newly
Vyacheslav Egorov (Google)
2012/11/27 16:26:12
Done.
|
+ // given properties. |
+ virtual void Notify(const char* name, |
+ uword base, |
+ uword prologue_offset, |
+ uword size, |
+ bool optimized) = 0; |
+}; |
+ |
class Dart : public AllStatic { |
public: |
static const char* InitOnce(Dart_IsolateCreateCallback create, |
@@ -48,12 +67,29 @@ class Dart : public AllStatic { |
return flow_graph_writer_; |
} |
+ static void RegisterCodeObserver(CodeObserver* observer); |
+ |
+ // Notify all active code observers about newly created code object. |
+ static void NotifyCodeObservers(const char* name, |
+ uword base, |
+ uword prologue_offset, |
+ uword size, |
+ bool optimized); |
+ |
+ // Returns true if there is at least one active code observer. |
+ static bool AreCodeObserversActive(); |
+ |
private: |
+ static void RegisterDefaultCodeObservers(); |
+ |
static Isolate* vm_isolate_; |
static ThreadPool* thread_pool_; |
static Dart_FileWriterFunction perf_events_writer_; |
static DebugInfo* pprof_symbol_generator_; |
static Dart_FileWriterFunction flow_graph_writer_; |
+ |
+ static intptr_t code_observers_length_; |
+ static CodeObserver** code_observers_; |
}; |
} // namespace dart |