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

Unified Diff: src/runtime.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 | « src/runtime.h ('k') | test/mjsunit/debug-backtrace.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 1198)
+++ src/runtime.cc (working copy)
@@ -4546,35 +4546,22 @@
// Adds a JavaScript function as a debug event listener.
-// args[0]: debug event listener function
+// args[0]: debug event listener function to set or null or undefined for
+// clearing the event listener function
// args[1]: object supplied during callback
-static Object* Runtime_AddDebugEventListener(Arguments args) {
+static Object* Runtime_SetDebugEventListener(Arguments args) {
ASSERT(args.length() == 2);
- // Convert the parameters to API objects to call the API function for adding
- // a JavaScript function as debug event listener.
- CONVERT_ARG_CHECKED(JSFunction, raw_fun, 0);
- v8::Handle<v8::Function> fun(ToApi<v8::Function>(raw_fun));
- v8::Handle<v8::Value> data(ToApi<v8::Value>(args.at<Object>(0)));
- v8::Debug::AddDebugEventListener(fun, data);
+ RUNTIME_ASSERT(args[0]->IsJSFunction() ||
+ args[0]->IsUndefined() ||
+ args[0]->IsNull());
+ Handle<Object> callback = args.at<Object>(0);
+ Handle<Object> data = args.at<Object>(1);
+ Debugger::SetEventListener(callback, data);
return Heap::undefined_value();
}
-// Removes a JavaScript function debug event listener.
-// args[0]: debug event listener function
-static Object* Runtime_RemoveDebugEventListener(Arguments args) {
- ASSERT(args.length() == 1);
- // Convert the parameter to an API object to call the API function for
- // removing a JavaScript function debug event listener.
- CONVERT_ARG_CHECKED(JSFunction, raw_fun, 0);
- v8::Handle<v8::Function> fun(ToApi<v8::Function>(raw_fun));
- v8::Debug::RemoveDebugEventListener(fun);
-
- return Heap::undefined_value();
-}
-
-
static Object* Runtime_Break(Arguments args) {
ASSERT(args.length() == 0);
StackGuard::DebugBreak();
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/debug-backtrace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698