Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: src/api.cc

Issue 2108024: Provide access to the debuggee context from debug event listener (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/api.cc
===================================================================
--- src/api.cc (revision 4685)
+++ src/api.cc (working copy)
@@ -3992,13 +3992,43 @@
// --- D e b u g S u p p o r t ---
#ifdef ENABLE_DEBUGGER_SUPPORT
+
+static v8::Debug::EventCallback event_callback = NULL;
+
+static void EventCallbackWrapper(const v8::Debug::EventDetails& event_details) {
+ if (event_callback) {
+ event_callback(event_details.GetEvent(),
+ event_details.GetExecutionState(),
+ event_details.GetEventData(),
+ event_details.GetCallbackData());
+ }
+}
+
+
bool Debug::SetDebugEventListener(EventCallback that, Handle<Value> data) {
EnsureInitialized("v8::Debug::SetDebugEventListener()");
ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
ENTER_V8;
+
+ event_callback = that;
+
HandleScope scope;
i::Handle<i::Object> proxy = i::Factory::undefined_value();
if (that != NULL) {
+ proxy = i::Factory::NewProxy(FUNCTION_ADDR(EventCallbackWrapper));
+ }
+ i::Debugger::SetEventListener(proxy, Utils::OpenHandle(*data));
+ return true;
+}
+
+
+bool Debug::SetDebugEventListener2(EventCallback2 that, Handle<Value> data) {
+ EnsureInitialized("v8::Debug::SetDebugEventListener2()");
+ ON_BAILOUT("v8::Debug::SetDebugEventListener2()", return false);
+ ENTER_V8;
+ HandleScope scope;
+ i::Handle<i::Object> proxy = i::Factory::undefined_value();
+ if (that != NULL) {
proxy = i::Factory::NewProxy(FUNCTION_ADDR(that));
}
i::Debugger::SetEventListener(proxy, Utils::OpenHandle(*data));

Powered by Google App Engine
This is Rietveld 408576698