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

Side by Side Diff: src/api.cc

Issue 100158: Create a transition API for the debug message handler (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
3253 return true; 3253 return true;
3254 } 3254 }
3255 3255
3256 3256
3257 void Debug::DebugBreak() { 3257 void Debug::DebugBreak() {
3258 if (!i::V8::HasBeenSetup()) return; 3258 if (!i::V8::HasBeenSetup()) return;
3259 i::StackGuard::DebugBreak(); 3259 i::StackGuard::DebugBreak();
3260 } 3260 }
3261 3261
3262 3262
3263 static v8::Debug::MessageHandler message_handler = NULL;
3264
3265 static void MessageHandlerWrapper(const v8::Debug::Message& message) {
3266 if (message_handler) {
3267 v8::String::Value json(message.GetJSON());
3268 message_handler(*json, json.length(), message.GetClientData());
3269 }
3270 }
3271
3272
3263 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler, 3273 void Debug::SetMessageHandler(v8::Debug::MessageHandler handler,
3264 bool message_handler_thread) { 3274 bool message_handler_thread) {
3265 EnsureInitialized("v8::Debug::SetMessageHandler"); 3275 EnsureInitialized("v8::Debug::SetMessageHandler");
3266 ENTER_V8; 3276 ENTER_V8;
3267 // Message handler thread not supported any more. Parameter temporally left in 3277 // Message handler thread not supported any more. Parameter temporally left in
3268 // the API for client compatability reasons. 3278 // the API for client compatability reasons.
3269 CHECK(!message_handler_thread); 3279 CHECK(!message_handler_thread);
3280
3281 // TODO(sgjesse) support the old message handler API through a simple wrapper.
3282 message_handler = handler;
3283 if (message_handler != NULL) {
3284 i::Debugger::SetMessageHandler(MessageHandlerWrapper);
3285 } else {
3286 i::Debugger::SetMessageHandler(NULL);
3287 }
3288 }
3289
3290
3291 void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
3292 EnsureInitialized("v8::Debug::SetMessageHandler");
3293 ENTER_V8;
3270 i::Debugger::SetMessageHandler(handler); 3294 i::Debugger::SetMessageHandler(handler);
3271 } 3295 }
3272 3296
3273 3297
3274 void Debug::SendCommand(const uint16_t* command, int length, 3298 void Debug::SendCommand(const uint16_t* command, int length,
3275 ClientData* client_data) { 3299 ClientData* client_data) {
3276 if (!i::V8::HasBeenSetup()) return; 3300 if (!i::V8::HasBeenSetup()) return;
3277 i::Debugger::ProcessCommand(i::Vector<const uint16_t>(command, length), 3301 i::Debugger::ProcessCommand(i::Vector<const uint16_t>(command, length),
3278 client_data); 3302 client_data);
3279 } 3303 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3387 reinterpret_cast<HandleScopeImplementer*>(storage); 3411 reinterpret_cast<HandleScopeImplementer*>(storage);
3388 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 3412 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
3389 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 3413 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
3390 &thread_local->handle_scope_data_; 3414 &thread_local->handle_scope_data_;
3391 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 3415 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
3392 3416
3393 return storage + ArchiveSpacePerThread(); 3417 return storage + ArchiveSpacePerThread();
3394 } 3418 }
3395 3419
3396 } } // namespace v8::internal 3420 } } // namespace v8::internal
OLDNEW
« include/v8-debug.h ('K') | « include/v8-debug.h ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698