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

Side by Side Diff: src/debug-agent.cc

Issue 100155: Re-submit http://codereview.chromium.org/99122 (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
« no previous file with comments | « src/debug-agent.h ('k') | test/cctest/test-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 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 16 matching lines...) Expand all
27 27
28 28
29 #include "v8.h" 29 #include "v8.h"
30 #include "debug-agent.h" 30 #include "debug-agent.h"
31 31
32 #ifdef ENABLE_DEBUGGER_SUPPORT 32 #ifdef ENABLE_DEBUGGER_SUPPORT
33 namespace v8 { namespace internal { 33 namespace v8 { namespace internal {
34 34
35 // Public V8 debugger API message handler function. This function just delegates 35 // Public V8 debugger API message handler function. This function just delegates
36 // to the debugger agent through it's data parameter. 36 // to the debugger agent through it's data parameter.
37 void DebuggerAgentMessageHandler(const uint16_t* message, int length, 37 void DebuggerAgentMessageHandler(const v8::Debug::Message& message) {
38 v8::Debug::ClientData* client_data) { 38 DebuggerAgent::instance_->DebuggerMessage(message);
39 DebuggerAgent::instance_->DebuggerMessage(message, length);
40 } 39 }
41 40
42 // static 41 // static
43 DebuggerAgent* DebuggerAgent::instance_ = NULL; 42 DebuggerAgent* DebuggerAgent::instance_ = NULL;
44 43
45 // Debugger agent main thread. 44 // Debugger agent main thread.
46 void DebuggerAgent::Run() { 45 void DebuggerAgent::Run() {
47 const int kOneSecondInMicros = 1000000; 46 const int kOneSecondInMicros = 1000000;
48 47
49 // Allow this socket to reuse port even if still in TIME_WAIT. 48 // Allow this socket to reuse port even if still in TIME_WAIT.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Terminate the session. 117 // Terminate the session.
119 if (session_ != NULL) { 118 if (session_ != NULL) {
120 session_->Shutdown(); 119 session_->Shutdown();
121 session_->Join(); 120 session_->Join();
122 delete session_; 121 delete session_;
123 session_ = NULL; 122 session_ = NULL;
124 } 123 }
125 } 124 }
126 125
127 126
128 void DebuggerAgent::DebuggerMessage(const uint16_t* message, int length) { 127 void DebuggerAgent::DebuggerMessage(const v8::Debug::Message& message) {
129 ScopedLock with(session_access_); 128 ScopedLock with(session_access_);
130 129
131 // Forward the message handling to the session. 130 // Forward the message handling to the session.
132 if (session_ != NULL) { 131 if (session_ != NULL) {
133 session_->DebuggerMessage(Vector<uint16_t>(const_cast<uint16_t*>(message), 132 v8::String::Value val(message.GetJSON());
134 length)); 133 session_->DebuggerMessage(Vector<uint16_t>(const_cast<uint16_t*>(*val),
134 val.length()));
135 } 135 }
136 } 136 }
137 137
138 138
139 void DebuggerAgent::OnSessionClosed(DebuggerAgentSession* session) { 139 void DebuggerAgent::OnSessionClosed(DebuggerAgentSession* session) {
140 // Don't do anything during termination. 140 // Don't do anything during termination.
141 if (terminate_) { 141 if (terminate_) {
142 return; 142 return;
143 } 143 }
144 144
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 return total_received; 408 return total_received;
409 } 409 }
410 total_received += received; 410 total_received += received;
411 } 411 }
412 return total_received; 412 return total_received;
413 } 413 }
414 414
415 } } // namespace v8::internal 415 } } // namespace v8::internal
416 416
417 #endif // ENABLE_DEBUGGER_SUPPORT 417 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/debug-agent.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698