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

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

Issue 704063002: Terminate and wait the worker thread in ~WebEmbeddedWorkerImpl() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/workers/WorkerThread.h ('k') | Source/web/WebEmbeddedWorkerImpl.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) 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // Prevent the deadlock between GC and an attempt to stop a thread. 409 // Prevent the deadlock between GC and an attempt to stop a thread.
410 ThreadState::SafePointScope safePointScope(ThreadState::HeapPointersOnStack) ; 410 ThreadState::SafePointScope safePointScope(ThreadState::HeapPointersOnStack) ;
411 stopInternal(); 411 stopInternal();
412 } 412 }
413 413
414 void WorkerThread::stopInShutdownSequence() 414 void WorkerThread::stopInShutdownSequence()
415 { 415 {
416 stopInternal(); 416 stopInternal();
417 } 417 }
418 418
419 void WorkerThread::terminateAndWait()
420 {
421 stop();
422 m_terminationEvent->wait();
423 }
424
419 bool WorkerThread::terminated() 425 bool WorkerThread::terminated()
420 { 426 {
421 MutexLocker lock(m_threadCreationMutex); 427 MutexLocker lock(m_threadCreationMutex);
422 return m_terminated; 428 return m_terminated;
423 } 429 }
424 430
425 void WorkerThread::stopInternal() 431 void WorkerThread::stopInternal()
426 { 432 {
427 // Protect against this method and initialize() racing each other. 433 // Protect against this method and initialize() racing each other.
428 MutexLocker lock(m_threadCreationMutex); 434 MutexLocker lock(m_threadCreationMutex);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); 533 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get());
528 } 534 }
529 535
530 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) 536 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController)
531 { 537 {
532 MutexLocker locker(m_workerInspectorControllerMutex); 538 MutexLocker locker(m_workerInspectorControllerMutex);
533 m_workerInspectorController = workerInspectorController; 539 m_workerInspectorController = workerInspectorController;
534 } 540 }
535 541
536 } // namespace blink 542 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerThread.h ('k') | Source/web/WebEmbeddedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698