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

Side by Side Diff: src/debug.h

Issue 87026: DevTools: Support eventless host message dispatching. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Rebase Created 11 years, 8 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
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 403
404 // Message send by user to v8 debugger or debugger output message. 404 // Message send by user to v8 debugger or debugger output message.
405 // In addition to command text it may contain a pointer to some user data 405 // In addition to command text it may contain a pointer to some user data
406 // which are expected to be passed along with the command reponse to message 406 // which are expected to be passed along with the command reponse to message
407 // handler. 407 // handler.
408 class Message { 408 class Message {
409 public: 409 public:
410 static Message NewCommand(const Vector<uint16_t>& command, 410 static Message NewCommand(const Vector<uint16_t>& command,
411 v8::Debug::ClientData* data); 411 v8::Debug::ClientData* data);
412 static Message NewHostDispatch(v8::Debug::ClientData* dispatch);
413 static Message NewOutput(v8::Handle<v8::String> output, 412 static Message NewOutput(v8::Handle<v8::String> output,
414 v8::Debug::ClientData* data); 413 v8::Debug::ClientData* data);
415 static Message NewEmptyMessage(); 414 static Message NewEmptyMessage();
416 Message(); 415 Message();
417 ~Message(); 416 ~Message();
418 417
419 // Deletes user data and disposes of the text. 418 // Deletes user data and disposes of the text.
420 void Dispose(); 419 void Dispose();
421 bool IsHostDispatch() const;
422 Vector<uint16_t> text() const { return text_; } 420 Vector<uint16_t> text() const { return text_; }
423 v8::Debug::ClientData* client_data() const { return client_data_; } 421 v8::Debug::ClientData* client_data() const { return client_data_; }
424 private: 422 private:
425 Message(const Vector<uint16_t>& text, 423 Message(const Vector<uint16_t>& text,
426 v8::Debug::ClientData* data, 424 v8::Debug::ClientData* data);
427 bool is_host_dispatch);
428 425
429 Vector<uint16_t> text_; 426 Vector<uint16_t> text_;
430 v8::Debug::ClientData* client_data_; 427 v8::Debug::ClientData* client_data_;
431 bool is_host_dispatch_;
432 }; 428 };
433 429
434 // A Queue of Vector<uint16_t> objects. A thread-safe version is 430 // A Queue of Vector<uint16_t> objects. A thread-safe version is
435 // LockingMessageQueue, based on this class. 431 // LockingMessageQueue, based on this class.
436 class MessageQueue BASE_EMBEDDED { 432 class MessageQueue BASE_EMBEDDED {
437 public: 433 public:
438 explicit MessageQueue(int size); 434 explicit MessageQueue(int size);
439 ~MessageQueue(); 435 ~MessageQueue();
440 bool IsEmpty() const { return start_ == end_; } 436 bool IsEmpty() const { return start_ == end_; }
441 Message Get(); 437 Message Get();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 Handle<Object> event_data, 499 Handle<Object> event_data,
504 bool auto_continue); 500 bool auto_continue);
505 static void NotifyMessageHandler(v8::DebugEvent event, 501 static void NotifyMessageHandler(v8::DebugEvent event,
506 Handle<Object> exec_state, 502 Handle<Object> exec_state,
507 Handle<Object> event_data, 503 Handle<Object> event_data,
508 bool auto_continue); 504 bool auto_continue);
509 static void SetEventListener(Handle<Object> callback, Handle<Object> data); 505 static void SetEventListener(Handle<Object> callback, Handle<Object> data);
510 static void SetMessageHandler(v8::Debug::MessageHandler handler, 506 static void SetMessageHandler(v8::Debug::MessageHandler handler,
511 bool message_handler_thread); 507 bool message_handler_thread);
512 static void TearDown(); 508 static void TearDown();
513 static void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler); 509 static void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
510 int period);
514 511
515 // Invoke the message handler function. 512 // Invoke the message handler function.
516 static void InvokeMessageHandler(Message message); 513 static void InvokeMessageHandler(Message message);
517 514
518 // Send a message to the message handler eiher through the message thread or 515 // Send a message to the message handler eiher through the message thread or
519 // directly. 516 // directly.
520 static void SendMessage(Message message); 517 static void SendMessage(Message message);
521 518
522 // Send the JSON message for a debug event. 519 // Send the JSON message for a debug event.
523 static bool SendEventMessage(Handle<Object> event_data); 520 static bool SendEventMessage(Handle<Object> event_data);
524 521
525 // Add a debugger command to the command queue. 522 // Add a debugger command to the command queue.
526 static void ProcessCommand(Vector<const uint16_t> command, 523 static void ProcessCommand(Vector<const uint16_t> command,
527 v8::Debug::ClientData* client_data = NULL); 524 v8::Debug::ClientData* client_data = NULL);
528 525
529 // Check whether there are commands in the command queue. 526 // Check whether there are commands in the command queue.
530 static bool HasCommands(); 527 static bool HasCommands();
531 528
532 static void ProcessHostDispatch(v8::Debug::ClientData* dispatch);
533 static Handle<Object> Call(Handle<JSFunction> fun, 529 static Handle<Object> Call(Handle<JSFunction> fun,
534 Handle<Object> data, 530 Handle<Object> data,
535 bool* pending_exception); 531 bool* pending_exception);
536 532
537 // Start the debugger agent listening on the provided port. 533 // Start the debugger agent listening on the provided port.
538 static bool StartAgent(const char* name, int port); 534 static bool StartAgent(const char* name, int port);
539 535
540 // Stop the debugger agent. 536 // Stop the debugger agent.
541 static void StopAgent(); 537 static void StopAgent();
542 538
(...skipping 26 matching lines...) Expand all
569 static Mutex* debugger_access_; // Mutex guarding debugger variables. 565 static Mutex* debugger_access_; // Mutex guarding debugger variables.
570 static Handle<Object> event_listener_; // Global handle to listener. 566 static Handle<Object> event_listener_; // Global handle to listener.
571 static Handle<Object> event_listener_data_; 567 static Handle<Object> event_listener_data_;
572 static bool compiling_natives_; // Are we compiling natives? 568 static bool compiling_natives_; // Are we compiling natives?
573 static bool is_loading_debugger_; // Are we loading the debugger? 569 static bool is_loading_debugger_; // Are we loading the debugger?
574 static bool never_unload_debugger_; // Can we unload the debugger? 570 static bool never_unload_debugger_; // Can we unload the debugger?
575 static DebugMessageThread* message_thread_; 571 static DebugMessageThread* message_thread_;
576 static v8::Debug::MessageHandler message_handler_; 572 static v8::Debug::MessageHandler message_handler_;
577 static bool message_handler_cleared_; // Was message handler cleared? 573 static bool message_handler_cleared_; // Was message handler cleared?
578 static v8::Debug::HostDispatchHandler host_dispatch_handler_; 574 static v8::Debug::HostDispatchHandler host_dispatch_handler_;
575 static int host_dispatch_micros_;
579 576
580 static DebuggerAgent* agent_; 577 static DebuggerAgent* agent_;
581 578
582 static const int kQueueInitialSize = 4; 579 static const int kQueueInitialSize = 4;
583 static LockingMessageQueue command_queue_; 580 static LockingMessageQueue command_queue_;
584 static LockingMessageQueue message_queue_; 581 static LockingMessageQueue message_queue_;
585 static Semaphore* command_received_; // Signaled for each command received. 582 static Semaphore* command_received_; // Signaled for each command received.
586 static Semaphore* message_received_; // Signalled for each message send. 583 static Semaphore* message_received_; // Signalled for each message send.
587 584
588 friend class EnterDebugger; 585 friend class EnterDebugger;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 Debug::AddressId id_; 745 Debug::AddressId id_;
749 int reg_; 746 int reg_;
750 }; 747 };
751 748
752 749
753 } } // namespace v8::internal 750 } } // namespace v8::internal
754 751
755 #endif // ENABLE_DEBUGGER_SUPPORT 752 #endif // ENABLE_DEBUGGER_SUPPORT
756 753
757 #endif // V8_V8_DEBUG_H_ 754 #endif // V8_V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698