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

Side by Side Diff: Source/core/workers/WorkerThread.cpp

Issue 468883002: Rename workerGlobalScopeDestroyed to workerThreadTerminated (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/WorkerReportingProxy.h ('k') | Source/web/ServiceWorkerGlobalScopeProxy.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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 String sourceCode = m_startupData->m_sourceCode; 241 String sourceCode = m_startupData->m_sourceCode;
242 WorkerThreadStartMode startMode = m_startupData->m_startMode; 242 WorkerThreadStartMode startMode = m_startupData->m_startMode;
243 243
244 { 244 {
245 MutexLocker lock(m_threadCreationMutex); 245 MutexLocker lock(m_threadCreationMutex);
246 246
247 // The worker was terminated before the thread had a chance to run. 247 // The worker was terminated before the thread had a chance to run.
248 if (m_terminated) { 248 if (m_terminated) {
249 // Notify the proxy that the WorkerGlobalScope has been disposed of. 249 // Notify the proxy that the WorkerGlobalScope has been disposed of.
250 // This can free this thread object, hence it must not be touched af terwards. 250 // This can free this thread object, hence it must not be touched af terwards.
251 m_workerReportingProxy.workerGlobalScopeDestroyed(); 251 m_workerReportingProxy.workerThreadTerminated();
252 return; 252 return;
253 } 253 }
254 254
255 m_microtaskRunner = adoptPtr(new MicrotaskRunner); 255 m_microtaskRunner = adoptPtr(new MicrotaskRunner);
256 m_thread->addTaskObserver(m_microtaskRunner.get()); 256 m_thread->addTaskObserver(m_microtaskRunner.get());
257 m_pendingGCRunner = adoptPtr(new PendingGCRunner); 257 m_pendingGCRunner = adoptPtr(new PendingGCRunner);
258 m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(m_thread. get())); 258 m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(m_thread. get()));
259 m_thread->addTaskObserver(m_pendingGCRunner.get()); 259 m_thread->addTaskObserver(m_pendingGCRunner.get());
260 ThreadState::attach(); 260 ThreadState::attach();
261 ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get()); 261 ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 ThreadState::detach(); 311 ThreadState::detach();
312 312
313 m_thread->removeTaskObserver(m_microtaskRunner.get()); 313 m_thread->removeTaskObserver(m_microtaskRunner.get());
314 m_microtaskRunner = nullptr; 314 m_microtaskRunner = nullptr;
315 m_thread->removeTaskObserver(m_pendingGCRunner.get()); 315 m_thread->removeTaskObserver(m_pendingGCRunner.get());
316 m_pendingGCRunner = nullptr; 316 m_pendingGCRunner = nullptr;
317 m_messageLoopInterruptor = nullptr; 317 m_messageLoopInterruptor = nullptr;
318 318
319 // Notify the proxy that the WorkerGlobalScope has been disposed of. 319 // Notify the proxy that the WorkerGlobalScope has been disposed of.
320 // This can free this thread object, hence it must not be touched afterwards . 320 // This can free this thread object, hence it must not be touched afterwards .
321 workerReportingProxy().workerGlobalScopeDestroyed(); 321 workerReportingProxy().workerThreadTerminated();
322 322
323 // Clean up PlatformThreadData before WTF::WTFThreadData goes away! 323 // Clean up PlatformThreadData before WTF::WTFThreadData goes away!
324 PlatformThreadData::current().destroy(); 324 PlatformThreadData::current().destroy();
325 } 325 }
326 326
327 class WorkerThreadShutdownFinishTask : public ExecutionContextTask { 327 class WorkerThreadShutdownFinishTask : public ExecutionContextTask {
328 public: 328 public:
329 static PassOwnPtr<WorkerThreadShutdownFinishTask> create() 329 static PassOwnPtr<WorkerThreadShutdownFinishTask> create()
330 { 330 {
331 return adoptPtr(new WorkerThreadShutdownFinishTask()); 331 return adoptPtr(new WorkerThreadShutdownFinishTask());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); 466 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get());
467 } 467 }
468 468
469 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) 469 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController)
470 { 470 {
471 MutexLocker locker(m_workerInspectorControllerMutex); 471 MutexLocker locker(m_workerInspectorControllerMutex);
472 m_workerInspectorController = workerInspectorController; 472 m_workerInspectorController = workerInspectorController;
473 } 473 }
474 474
475 } // namespace blink 475 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerReportingProxy.h ('k') | Source/web/ServiceWorkerGlobalScopeProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698