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

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

Issue 432673003: Revert of Change WokerThread to use a blink::WebThread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « Source/core/workers/WorkerThread.cpp ('k') | Source/web/WebWorkerRunLoop.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask> task) OVERRID E 120 virtual void postTaskToLoader(PassOwnPtr<ExecutionContextTask> task) OVERRID E
121 { 121 {
122 toWebLocalFrameImpl(m_embeddedWorker.m_mainFrame)->frame()->document()-> postTask(task); 122 toWebLocalFrameImpl(m_embeddedWorker.m_mainFrame)->frame()->document()-> postTask(task);
123 } 123 }
124 124
125 virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask> ta sk) OVERRIDE 125 virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<ExecutionContextTask> ta sk) OVERRIDE
126 { 126 {
127 if (m_embeddedWorker.m_askedToTerminate || !m_embeddedWorker.m_workerThr ead) 127 if (m_embeddedWorker.m_askedToTerminate || !m_embeddedWorker.m_workerThr ead)
128 return false; 128 return false;
129 m_embeddedWorker.m_workerThread->postTask(task); 129 return m_embeddedWorker.m_workerThread->runLoop().postTask(task);
130 return !m_embeddedWorker.m_workerThread->terminated();
131 } 130 }
132 131
133 private: 132 private:
134 explicit LoaderProxy(WebEmbeddedWorkerImpl& embeddedWorker) 133 explicit LoaderProxy(WebEmbeddedWorkerImpl& embeddedWorker)
135 : m_embeddedWorker(embeddedWorker) 134 : m_embeddedWorker(embeddedWorker)
136 { 135 {
137 } 136 }
138 137
139 // Not owned, embedded worker owns this. 138 // Not owned, embedded worker owns this.
140 WebEmbeddedWorkerImpl& m_embeddedWorker; 139 WebEmbeddedWorkerImpl& m_embeddedWorker;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ASSERT(!m_askedToTerminate); 250 ASSERT(!m_askedToTerminate);
252 bool wasPaused = (m_pauseAfterDownloadState == IsPausedAfterDownload); 251 bool wasPaused = (m_pauseAfterDownloadState == IsPausedAfterDownload);
253 m_pauseAfterDownloadState = DontPauseAfterDownload; 252 m_pauseAfterDownloadState = DontPauseAfterDownload;
254 if (wasPaused) 253 if (wasPaused)
255 startWorkerThread(); 254 startWorkerThread();
256 } 255 }
257 256
258 void WebEmbeddedWorkerImpl::resumeWorkerContext() 257 void WebEmbeddedWorkerImpl::resumeWorkerContext()
259 { 258 {
260 if (m_workerThread) 259 if (m_workerThread)
261 m_workerThread->postDebuggerTask(createCrossThreadTask(resumeWorkerConte xtTask, true)); 260 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(resumeW orkerContextTask, true));
262 } 261 }
263 262
264 void WebEmbeddedWorkerImpl::attachDevTools() 263 void WebEmbeddedWorkerImpl::attachDevTools()
265 { 264 {
266 if (m_workerThread) 265 if (m_workerThread)
267 m_workerThread->postDebuggerTask(createCrossThreadTask(connectToWorkerCo ntextInspectorTask, true)); 266 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(connect ToWorkerContextInspectorTask, true));
268 } 267 }
269 268
270 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& savedState) 269 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& savedState)
271 { 270 {
272 m_workerThread->postDebuggerTask(createCrossThreadTask(reconnectToWorkerCont extInspectorTask, String(savedState))); 271 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(reconnectTo WorkerContextInspectorTask, String(savedState)));
273 } 272 }
274 273
275 void WebEmbeddedWorkerImpl::detachDevTools() 274 void WebEmbeddedWorkerImpl::detachDevTools()
276 { 275 {
277 m_workerThread->postDebuggerTask(createCrossThreadTask(disconnectFromWorkerC ontextInspectorTask, true)); 276 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(disconnectF romWorkerContextInspectorTask, true));
278 } 277 }
279 278
280 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(const WebString& message) 279 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(const WebString& message)
281 { 280 {
282 if (m_askedToTerminate) 281 if (m_askedToTerminate)
283 return; 282 return;
284 m_workerThread->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa ckendTask, String(message))); 283 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(dispatchOnI nspectorBackendTask, String(message)));
285 m_workerThread->interruptAndDispatchInspectorCommands(); 284 m_workerThread->interruptAndDispatchInspectorCommands();
286 } 285 }
287 286
288 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader() 287 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader()
289 { 288 {
290 // Create 'shadow page', which is never displayed and is used mainly to 289 // Create 'shadow page', which is never displayed and is used mainly to
291 // provide a context for loading on the main thread. 290 // provide a context for loading on the main thread.
292 // 291 //
293 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. 292 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader.
294 // This code, and probably most of the code in this class should be shared 293 // This code, and probably most of the code in this class should be shared
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 m_mainScriptLoader.clear(); 378 m_mainScriptLoader.clear();
380 379
381 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient); 380 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient);
382 m_loaderProxy = LoaderProxy::create(*this); 381 m_loaderProxy = LoaderProxy::create(*this);
383 382
384 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release()); 383 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release());
385 m_workerThread->start(); 384 m_workerThread->start();
386 } 385 }
387 386
388 } // namespace blink 387 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerThread.cpp ('k') | Source/web/WebWorkerRunLoop.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698