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

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

Issue 423303004: Change WokerThread to use a blink::WebThread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove changes made to WebThread. 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 return m_embeddedWorker.m_workerThread->runLoop().postTask(task); 129 m_embeddedWorker.m_workerThread->postTask(task);
130 return !m_embeddedWorker.m_workerThread->terminated();
130 } 131 }
131 132
132 private: 133 private:
133 explicit LoaderProxy(WebEmbeddedWorkerImpl& embeddedWorker) 134 explicit LoaderProxy(WebEmbeddedWorkerImpl& embeddedWorker)
134 : m_embeddedWorker(embeddedWorker) 135 : m_embeddedWorker(embeddedWorker)
135 { 136 {
136 } 137 }
137 138
138 // Not owned, embedded worker owns this. 139 // Not owned, embedded worker owns this.
139 WebEmbeddedWorkerImpl& m_embeddedWorker; 140 WebEmbeddedWorkerImpl& m_embeddedWorker;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ASSERT(!m_askedToTerminate); 251 ASSERT(!m_askedToTerminate);
251 bool wasPaused = (m_pauseAfterDownloadState == IsPausedAfterDownload); 252 bool wasPaused = (m_pauseAfterDownloadState == IsPausedAfterDownload);
252 m_pauseAfterDownloadState = DontPauseAfterDownload; 253 m_pauseAfterDownloadState = DontPauseAfterDownload;
253 if (wasPaused) 254 if (wasPaused)
254 startWorkerThread(); 255 startWorkerThread();
255 } 256 }
256 257
257 void WebEmbeddedWorkerImpl::resumeWorkerContext() 258 void WebEmbeddedWorkerImpl::resumeWorkerContext()
258 { 259 {
259 if (m_workerThread) 260 if (m_workerThread)
260 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(resumeW orkerContextTask, true)); 261 m_workerThread->postDebuggerTask(createCrossThreadTask(resumeWorkerConte xtTask, true));
261 } 262 }
262 263
263 void WebEmbeddedWorkerImpl::attachDevTools() 264 void WebEmbeddedWorkerImpl::attachDevTools()
264 { 265 {
265 if (m_workerThread) 266 if (m_workerThread)
266 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(connect ToWorkerContextInspectorTask, true)); 267 m_workerThread->postDebuggerTask(createCrossThreadTask(connectToWorkerCo ntextInspectorTask, true));
267 } 268 }
268 269
269 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& savedState) 270 void WebEmbeddedWorkerImpl::reattachDevTools(const WebString& savedState)
270 { 271 {
271 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(reconnectTo WorkerContextInspectorTask, String(savedState))); 272 m_workerThread->postDebuggerTask(createCrossThreadTask(reconnectToWorkerCont extInspectorTask, String(savedState)));
272 } 273 }
273 274
274 void WebEmbeddedWorkerImpl::detachDevTools() 275 void WebEmbeddedWorkerImpl::detachDevTools()
275 { 276 {
276 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(disconnectF romWorkerContextInspectorTask, true)); 277 m_workerThread->postDebuggerTask(createCrossThreadTask(disconnectFromWorkerC ontextInspectorTask, true));
277 } 278 }
278 279
279 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(const WebString& message) 280 void WebEmbeddedWorkerImpl::dispatchDevToolsMessage(const WebString& message)
280 { 281 {
281 if (m_askedToTerminate) 282 if (m_askedToTerminate)
282 return; 283 return;
283 m_workerThread->runLoop().postDebuggerTask(createCrossThreadTask(dispatchOnI nspectorBackendTask, String(message))); 284 m_workerThread->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa ckendTask, String(message)));
284 m_workerThread->interruptAndDispatchInspectorCommands(); 285 m_workerThread->interruptAndDispatchInspectorCommands();
285 } 286 }
286 287
287 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader() 288 void WebEmbeddedWorkerImpl::prepareShadowPageForLoader()
288 { 289 {
289 // Create 'shadow page', which is never displayed and is used mainly to 290 // Create 'shadow page', which is never displayed and is used mainly to
290 // provide a context for loading on the main thread. 291 // provide a context for loading on the main thread.
291 // 292 //
292 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader. 293 // FIXME: This does mostly same as WebSharedWorkerImpl::initializeLoader.
293 // This code, and probably most of the code in this class should be shared 294 // 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
378 m_mainScriptLoader.clear(); 379 m_mainScriptLoader.clear();
379 380
380 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient); 381 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient);
381 m_loaderProxy = LoaderProxy::create(*this); 382 m_loaderProxy = LoaderProxy::create(*this);
382 383
383 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release()); 384 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release());
384 m_workerThread->start(); 385 m_workerThread->start();
385 } 386 }
386 387
387 } // namespace blink 388 } // 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