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

Unified Diff: src/api.cc

Issue 19753: Changed the debugger API to allow only one debug event listener to be registe... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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
« no previous file with comments | « include/v8-debug.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
===================================================================
--- src/api.cc (revision 1198)
+++ src/api.cc (working copy)
@@ -2816,81 +2816,25 @@
// --- D e b u g S u p p o r t ---
-bool Debug::AddDebugEventListener(DebugEventCallback that, Handle<Value> data) {
- EnsureInitialized("v8::Debug::AddDebugEventListener()");
- ON_BAILOUT("v8::Debug::AddDebugEventListener()", return false);
+bool Debug::SetDebugEventListener(DebugEventCallback that, Handle<Value> data) {
+ EnsureInitialized("v8::Debug::SetDebugEventListener()");
+ ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
HandleScope scope;
- NeanderArray listeners(i::Factory::debug_event_listeners());
- NeanderObject obj(2);
- obj.set(0, *i::Factory::NewProxy(FUNCTION_ADDR(that)));
- obj.set(1, data.IsEmpty() ?
- i::Heap::undefined_value() :
- *Utils::OpenHandle(*data));
- listeners.add(obj.value());
- i::Debugger::UpdateActiveDebugger();
+ i::Debugger::SetEventListener(i::Factory::NewProxy(FUNCTION_ADDR(that)),
+ Utils::OpenHandle(*data));
return true;
}
-bool Debug::AddDebugEventListener(v8::Handle<v8::Function> that,
+bool Debug::SetDebugEventListener(v8::Handle<v8::Object> that,
Handle<Value> data) {
- ON_BAILOUT("v8::Debug::AddDebugEventListener()", return false);
- HandleScope scope;
- NeanderArray listeners(i::Factory::debug_event_listeners());
- NeanderObject obj(2);
- obj.set(0, *Utils::OpenHandle(*that));
- obj.set(1, data.IsEmpty() ?
- i::Heap::undefined_value() :
- *Utils::OpenHandle(*data));
- listeners.add(obj.value());
- i::Debugger::UpdateActiveDebugger();
+ ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false);
+ i::Debugger::SetEventListener(Utils::OpenHandle(*that),
+ Utils::OpenHandle(*data));
return true;
}
-void Debug::RemoveDebugEventListener(DebugEventCallback that) {
- EnsureInitialized("v8::Debug::RemoveDebugEventListener()");
- ON_BAILOUT("v8::Debug::RemoveDebugEventListener()", return);
- HandleScope scope;
- NeanderArray listeners(i::Factory::debug_event_listeners());
- for (int i = 0; i < listeners.length(); i++) {
- if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
-
- NeanderObject listener(i::JSObject::cast(listeners.get(i)));
- // When removing a C debug event listener only consider proxy objects.
- if (listener.get(0)->IsProxy()) {
- i::Handle<i::Proxy> callback_obj(i::Proxy::cast(listener.get(0)));
- if (callback_obj->proxy() == FUNCTION_ADDR(that)) {
- listeners.set(i, i::Heap::undefined_value());
- }
- }
- }
- i::Debugger::UpdateActiveDebugger();
-}
-
-
-void Debug::RemoveDebugEventListener(v8::Handle<v8::Function> that) {
- ON_BAILOUT("v8::Debug::RemoveDebugEventListener()", return);
- HandleScope scope;
- NeanderArray listeners(i::Factory::debug_event_listeners());
- for (int i = 0; i < listeners.length(); i++) {
- if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
-
- NeanderObject listener(i::JSObject::cast(listeners.get(i)));
- // When removing a JavaScript debug event listener only consider JavaScript
- // function objects.
- if (listener.get(0)->IsJSFunction()) {
- i::JSFunction* callback = i::JSFunction::cast(listener.get(0));
- i::Handle<i::JSFunction> callback_fun(callback);
- if (callback_fun.is_identical_to(Utils::OpenHandle(*that))) {
- listeners.set(i, i::Heap::undefined_value());
- }
- }
- }
- i::Debugger::UpdateActiveDebugger();
-}
-
-
void Debug::DebugBreak() {
if (!i::V8::HasBeenSetup()) return;
i::StackGuard::DebugBreak();
« no previous file with comments | « include/v8-debug.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698