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

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

Issue 21095008: Revert the latest set of platform changes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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') | src/globals.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 100
101 void DebuggerAgent::WaitUntilListening() { 101 void DebuggerAgent::WaitUntilListening() {
102 listening_->Wait(); 102 listening_->Wait();
103 } 103 }
104 104
105 static const char* kCreateSessionMessage = 105 static const char* kCreateSessionMessage =
106 "Remote debugging session already active\r\n"; 106 "Remote debugging session already active\r\n";
107 107
108 void DebuggerAgent::CreateSession(Socket* client) { 108 void DebuggerAgent::CreateSession(Socket* client) {
109 ScopedLock with(&session_access_); 109 ScopedLock with(session_access_);
110 110
111 // If another session is already established terminate this one. 111 // If another session is already established terminate this one.
112 if (session_ != NULL) { 112 if (session_ != NULL) {
113 client->Send(kCreateSessionMessage, StrLength(kCreateSessionMessage)); 113 client->Send(kCreateSessionMessage, StrLength(kCreateSessionMessage));
114 delete client; 114 delete client;
115 return; 115 return;
116 } 116 }
117 117
118 // Create a new session and hook up the debug message handler. 118 // Create a new session and hook up the debug message handler.
119 session_ = new DebuggerAgentSession(this, client); 119 session_ = new DebuggerAgentSession(this, client);
120 isolate_->debugger()->SetMessageHandler(DebuggerAgentMessageHandler); 120 isolate_->debugger()->SetMessageHandler(DebuggerAgentMessageHandler);
121 session_->Start(); 121 session_->Start();
122 } 122 }
123 123
124 124
125 void DebuggerAgent::CloseSession() { 125 void DebuggerAgent::CloseSession() {
126 ScopedLock with(&session_access_); 126 ScopedLock with(session_access_);
127 127
128 // Terminate the session. 128 // Terminate the session.
129 if (session_ != NULL) { 129 if (session_ != NULL) {
130 session_->Shutdown(); 130 session_->Shutdown();
131 session_->Join(); 131 session_->Join();
132 delete session_; 132 delete session_;
133 session_ = NULL; 133 session_ = NULL;
134 } 134 }
135 } 135 }
136 136
137 137
138 void DebuggerAgent::DebuggerMessage(const v8::Debug::Message& message) { 138 void DebuggerAgent::DebuggerMessage(const v8::Debug::Message& message) {
139 ScopedLock with(&session_access_); 139 ScopedLock with(session_access_);
140 140
141 // Forward the message handling to the session. 141 // Forward the message handling to the session.
142 if (session_ != NULL) { 142 if (session_ != NULL) {
143 v8::String::Value val(message.GetJSON()); 143 v8::String::Value val(message.GetJSON());
144 session_->DebuggerMessage(Vector<uint16_t>(const_cast<uint16_t*>(*val), 144 session_->DebuggerMessage(Vector<uint16_t>(const_cast<uint16_t*>(*val),
145 val.length())); 145 val.length()));
146 } 146 }
147 } 147 }
148 148
149 149
150 void DebuggerAgent::OnSessionClosed(DebuggerAgentSession* session) { 150 void DebuggerAgent::OnSessionClosed(DebuggerAgentSession* session) {
151 // Don't do anything during termination. 151 // Don't do anything during termination.
152 if (terminate_) { 152 if (terminate_) {
153 return; 153 return;
154 } 154 }
155 155
156 // Terminate the session. 156 // Terminate the session.
157 ScopedLock with(&session_access_); 157 ScopedLock with(session_access_);
158 ASSERT(session == session_); 158 ASSERT(session == session_);
159 if (session == session_) { 159 if (session == session_) {
160 session_->Shutdown(); 160 session_->Shutdown();
161 delete session_; 161 delete session_;
162 session_ = NULL; 162 session_ = NULL;
163 } 163 }
164 } 164 }
165 165
166 166
167 void DebuggerAgentSession::Run() { 167 void DebuggerAgentSession::Run() {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return total_received; 453 return total_received;
454 } 454 }
455 total_received += received; 455 total_received += received;
456 } 456 }
457 return total_received; 457 return total_received;
458 } 458 }
459 459
460 } } // namespace v8::internal 460 } } // namespace v8::internal
461 461
462 #endif // ENABLE_DEBUGGER_SUPPORT 462 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/debug-agent.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698