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

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

Issue 1408363004: [DevTools] Filter any messages from previous sessions 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // terminate during waiting for debugger. 145 // terminate during waiting for debugger.
146 ASSERT(m_workerStartData.waitForDebuggerMode == WebEmbeddedWorkerStartDa ta::WaitForDebugger); 146 ASSERT(m_workerStartData.waitForDebuggerMode == WebEmbeddedWorkerStartDa ta::WaitForDebugger);
147 // This deletes 'this'. 147 // This deletes 'this'.
148 m_workerContextClient->workerContextFailedToStart(); 148 m_workerContextClient->workerContextFailedToStart();
149 return; 149 return;
150 } 150 }
151 m_workerThread->terminate(); 151 m_workerThread->terminate();
152 m_workerInspectorProxy->workerThreadTerminated(); 152 m_workerInspectorProxy->workerThreadTerminated();
153 } 153 }
154 154
155 void WebEmbeddedWorkerImpl::attachDevTools(const WebString& hostId) 155 void WebEmbeddedWorkerImpl::attachDevTools(const WebString& hostId, int sessionI d)
156 { 156 {
157 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 157 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
158 if (devtoolsAgent) 158 if (devtoolsAgent)
159 devtoolsAgent->attach(hostId); 159 devtoolsAgent->attach(hostId, sessionId);
160 } 160 }
161 161
162 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& hostId, const WebS tring& savedState) 162 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& hostId, int sessio nId, const WebString& savedState)
163 { 163 {
164 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 164 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
165 if (devtoolsAgent) 165 if (devtoolsAgent)
166 devtoolsAgent->reattach(hostId, savedState); 166 devtoolsAgent->reattach(hostId, sessionId, savedState);
167 resumeStartup(); 167 resumeStartup();
168 } 168 }
169 169
170 void WebEmbeddedWorkerImpl::detachDevTools() 170 void WebEmbeddedWorkerImpl::detachDevTools()
171 { 171 {
172 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 172 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
173 if (devtoolsAgent) 173 if (devtoolsAgent)
174 devtoolsAgent->detach(); 174 devtoolsAgent->detach();
175 } 175 }
176 176
177 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(const WebString& message) 177 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(int sessionId, const WebStri ng& message)
178 { 178 {
179 if (m_askedToTerminate) 179 if (m_askedToTerminate)
180 return; 180 return;
181 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent(); 181 WebDevToolsAgent* devtoolsAgent = m_mainFrame->devToolsAgent();
182 if (devtoolsAgent) 182 if (devtoolsAgent)
183 devtoolsAgent->dispatchOnInspectorBackend(message); 183 devtoolsAgent->dispatchOnInspectorBackend(sessionId, message);
184 } 184 }
185 185
186 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message) 186 void WebEmbeddedWorkerImpl::postMessageToPageInspector(const String& message)
187 { 187 {
188 WorkerInspectorProxy::PageInspector* pageInspector = m_workerInspectorProxy- >pageInspector(); 188 WorkerInspectorProxy::PageInspector* pageInspector = m_workerInspectorProxy- >pageInspector();
189 if (!pageInspector) 189 if (!pageInspector)
190 return; 190 return;
191 pageInspector->dispatchMessageFromWorker(message); 191 pageInspector->dispatchMessageFromWorker(message);
192 } 192 }
193 193
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 m_mainScriptLoader->loadAsynchronously( 273 m_mainScriptLoader->loadAsynchronously(
274 *m_mainFrame->frame()->document(), 274 *m_mainFrame->frame()->document(),
275 m_workerStartData.scriptURL, 275 m_workerStartData.scriptURL,
276 DenyCrossOriginRequests, 276 DenyCrossOriginRequests,
277 nullptr, 277 nullptr,
278 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, this)); 278 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, this));
279 // Do nothing here since onScriptLoaderFinished() might have been already 279 // Do nothing here since onScriptLoaderFinished() might have been already
280 // invoked and |this| might have been deleted at this point. 280 // invoked and |this| might have been deleted at this point.
281 } 281 }
282 282
283 void WebEmbeddedWorkerImpl::sendProtocolMessage(int callId, const WebString& mes sage, const WebString& state) 283 void WebEmbeddedWorkerImpl::sendProtocolMessage(int sessionId, int callId, const WebString& message, const WebString& state)
284 { 284 {
285 m_workerContextClient->sendDevToolsMessage(callId, message, state); 285 m_workerContextClient->sendDevToolsMessage(sessionId, callId, message, state );
286 } 286 }
287 287
288 void WebEmbeddedWorkerImpl::resumeStartup() 288 void WebEmbeddedWorkerImpl::resumeStartup()
289 { 289 {
290 WaitingForDebuggerState waitingForDebuggerState = m_waitingForDebuggerState; 290 WaitingForDebuggerState waitingForDebuggerState = m_waitingForDebuggerState;
291 m_waitingForDebuggerState = NotWaitingForDebugger; 291 m_waitingForDebuggerState = NotWaitingForDebugger;
292 if (waitingForDebuggerState == WaitingForDebuggerBeforeLoadingScript) 292 if (waitingForDebuggerState == WaitingForDebuggerBeforeLoadingScript)
293 loadShadowPage(); 293 loadShadowPage();
294 else if (waitingForDebuggerState == WaitingForDebuggerAfterScriptLoaded) 294 else if (waitingForDebuggerState == WaitingForDebuggerAfterScriptLoaded)
295 startWorkerThread(); 295 startWorkerThread();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 m_mainScriptLoader.clear(); 353 m_mainScriptLoader.clear();
354 354
355 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient); 355 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *doc ument, *m_workerContextClient);
356 m_loaderProxy = WorkerLoaderProxy::create(this); 356 m_loaderProxy = WorkerLoaderProxy::create(this);
357 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy); 357 m_workerThread = ServiceWorkerThread::create(m_loaderProxy, *m_workerGlobalS copeProxy);
358 m_workerThread->start(startupData.release()); 358 m_workerThread->start(startupData.release());
359 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL); 359 m_workerInspectorProxy->workerThreadCreated(document, m_workerThread.get(), scriptURL);
360 } 360 }
361 361
362 } // namespace blink 362 } // 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