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

Side by Side Diff: third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp

Issue 1437283003: [DevTools] filter any messages from previous session in DevToolsAgentHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // terminate during waiting for debugger. 150 // terminate during waiting for debugger.
151 ASSERT(m_workerStartData.waitForDebuggerMode == WebEmbeddedWorkerStartDa ta::WaitForDebugger); 151 ASSERT(m_workerStartData.waitForDebuggerMode == WebEmbeddedWorkerStartDa ta::WaitForDebugger);
152 // This deletes 'this'. 152 // This deletes 'this'.
153 m_workerContextClient->workerContextFailedToStart(); 153 m_workerContextClient->workerContextFailedToStart();
154 return; 154 return;
155 } 155 }
156 m_workerThread->terminate(); 156 m_workerThread->terminate();
157 m_workerInspectorProxy->workerThreadTerminated(); 157 m_workerInspectorProxy->workerThreadTerminated();
158 } 158 }
159 159
160 void WebEmbeddedWorkerImpl::attachDevTools(const WebString& hostId) 160 void WebEmbeddedWorkerImpl::attachDevTools(const WebString& hostId, int sessionI d)
161 { 161 {
162 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 162 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
163 if (devtoolsAgent) 163 if (devtoolsAgent)
164 devtoolsAgent->attach(hostId); 164 devtoolsAgent->attach(hostId, sessionId);
165 } 165 }
166 166
167 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& hostId, const WebS tring& savedState) 167 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& hostId, int sessio nId, const WebString& savedState)
168 { 168 {
169 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 169 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
170 if (devtoolsAgent) 170 if (devtoolsAgent)
171 devtoolsAgent->reattach(hostId, savedState); 171 devtoolsAgent->reattach(hostId, sessionId, savedState);
172 resumeStartup(); 172 resumeStartup();
173 } 173 }
174 174
175 void WebEmbeddedWorkerImpl::detachDevTools() 175 void WebEmbeddedWorkerImpl::detachDevTools()
176 { 176 {
177 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 177 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
178 if (devtoolsAgent) 178 if (devtoolsAgent)
179 devtoolsAgent->detach(); 179 devtoolsAgent->detach();
180 } 180 }
181 181
182 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(const WebString& message) 182 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(int sessionId, const WebStri ng& message)
183 { 183 {
184 if (m_askedToTerminate) 184 if (m_askedToTerminate)
185 return; 185 return;
186 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 186 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
187 if (devtoolsAgent) 187 if (devtoolsAgent)
188 devtoolsAgent->dispatchOnInspectorBackend(message); 188 devtoolsAgent->dispatchOnInspectorBackend(sessionId, message);
189 } 189 }
190 190
191 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message) 191 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message)
192 { 192 {
193 WorkerInspectorProxy::PageInspector* pageInspector = m_workerInspectorProxy- >pageInspector(); 193 WorkerInspectorProxy::PageInspector* pageInspector = m_workerInspectorProxy- >pageInspector();
194 if (!pageInspector) 194 if (!pageInspector)
195 return; 195 return;
196 pageInspector->dispatchMessageFromWorker(message); 196 pageInspector->dispatchMessageFromWorker(message);
197 } 197 }
198 198
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 m_mainScriptLoader->loadAsynchronously( 278 m_mainScriptLoader->loadAsynchronously(
279 *m_mainFrame->frame()->document(), 279 *m_mainFrame->frame()->document(),
280 m_workerStartData.scriptURL, 280 m_workerStartData.scriptURL,
281 DenyCrossOriginRequests, 281 DenyCrossOriginRequests,
282 nullptr, 282 nullptr,
283 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, this)); 283 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, this));
284 // Do nothing here since onScriptLoaderFinished() might have been already 284 // Do nothing here since onScriptLoaderFinished() might have been already
285 // invoked and |this| might have been deleted at this point. 285 // invoked and |this| might have been deleted at this point.
286 } 286 }
287 287
288 void WebEmbeddedWorkerImpl::sendProtocolMessage(int callId, const WebString& mes sage, const WebString& state) 288 void WebEmbeddedWorkerImpl::sendProtocolMessage(int sessionId, int callId, const WebString& message, const WebString& state)
289 { 289 {
290 m_workerContextClient->sendDevToolsMessage(callId, message, state); 290 m_workerContextClient->sendDevToolsMessage(sessionId, callId, message, state );
291 } 291 }
292 292
293 void WebEmbeddedWorkerImpl::resumeStartup() 293 void WebEmbeddedWorkerImpl::resumeStartup()
294 { 294 {
295 WaitingForDebuggerState waitingForDebuggerState = m_waitingForDebuggerState; 295 WaitingForDebuggerState waitingForDebuggerState = m_waitingForDebuggerState;
296 m_waitingForDebuggerState = NotWaitingForDebugger; 296 m_waitingForDebuggerState = NotWaitingForDebugger;
297 if (waitingForDebuggerState == WaitingForDebuggerBeforeLoadingScript) 297 if (waitingForDebuggerState == WaitingForDebuggerBeforeLoadingScript)
298 loadShadowPage(); 298 loadShadowPage();
299 else if (waitingForDebuggerState == WaitingForDebuggerAfterScriptLoaded) 299 else if (waitingForDebuggerState == WaitingForDebuggerAfterScriptLoaded)
300 startWorkerThread(); 300 startWorkerThread();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 m_mainScriptLoader.clear(); 358 m_mainScriptLoader.clear();
359 359
360 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient); 360 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient);
361 m_loaderProxy = WorkerLoaderProxy::create(this); 361 m_loaderProxy = WorkerLoaderProxy::create(this);
362 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy); 362 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy);
363 m_workerThread->start(startupData.release()); 363 m_workerThread->start(startupData.release());
364 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); 364 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL);
365 } 365 }
366 366
367 } // namespace blink 367 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698