OLD | NEW |
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 27 matching lines...) Expand all Loading... |
38 #include "core/workers/WorkerReportingProxy.h" | 38 #include "core/workers/WorkerReportingProxy.h" |
39 #include "core/workers/WorkerThreadStartupData.h" | 39 #include "core/workers/WorkerThreadStartupData.h" |
40 #include "platform/PlatformThreadData.h" | 40 #include "platform/PlatformThreadData.h" |
41 #include "platform/Task.h" | 41 #include "platform/Task.h" |
42 #include "platform/ThreadTimers.h" | 42 #include "platform/ThreadTimers.h" |
43 #include "platform/heap/ThreadState.h" | 43 #include "platform/heap/ThreadState.h" |
44 #include "platform/weborigin/KURL.h" | 44 #include "platform/weborigin/KURL.h" |
45 #include "public/platform/Platform.h" | 45 #include "public/platform/Platform.h" |
46 #include "public/platform/WebThread.h" | 46 #include "public/platform/WebThread.h" |
47 #include "public/platform/WebWaitableEvent.h" | 47 #include "public/platform/WebWaitableEvent.h" |
48 #include "public/platform/WebWorkerRunLoop.h" | |
49 #include "wtf/Noncopyable.h" | 48 #include "wtf/Noncopyable.h" |
50 #include "wtf/WeakPtr.h" | 49 #include "wtf/WeakPtr.h" |
51 #include "wtf/text/WTFString.h" | 50 #include "wtf/text/WTFString.h" |
52 | 51 |
53 #include <utility> | 52 #include <utility> |
54 | 53 |
55 namespace blink { | 54 namespace blink { |
56 | 55 |
57 namespace { | 56 namespace { |
58 const int64_t kShortIdleHandlerDelayMs = 1000; | 57 const int64_t kShortIdleHandlerDelayMs = 1000; |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 // Ensure that tasks are being handled by thread event loop. If script execu
tion weren't forbidden, a while(1) loop in JS could keep the thread alive foreve
r. | 472 // Ensure that tasks are being handled by thread event loop. If script execu
tion weren't forbidden, a while(1) loop in JS could keep the thread alive foreve
r. |
474 m_workerGlobalScope->script()->scheduleExecutionTermination(); | 473 m_workerGlobalScope->script()->scheduleExecutionTermination(); |
475 InspectorInstrumentation::didKillAllExecutionContextTasks(m_workerGlobalScop
e.get()); | 474 InspectorInstrumentation::didKillAllExecutionContextTasks(m_workerGlobalScop
e.get()); |
476 m_debuggerMessageQueue.kill(); | 475 m_debuggerMessageQueue.kill(); |
477 postTask(FROM_HERE, WorkerThreadShutdownStartTask::create()); | 476 postTask(FROM_HERE, WorkerThreadShutdownStartTask::create()); |
478 } | 477 } |
479 | 478 |
480 void WorkerThread::didStartRunLoop() | 479 void WorkerThread::didStartRunLoop() |
481 { | 480 { |
482 ASSERT(isCurrentThread()); | 481 ASSERT(isCurrentThread()); |
483 blink::Platform::current()->didStartWorkerRunLoop(WebWorkerRunLoop(this)); | 482 blink::Platform::current()->didStartWorkerRunLoop(); |
484 } | 483 } |
485 | 484 |
486 void WorkerThread::didStopRunLoop() | 485 void WorkerThread::didStopRunLoop() |
487 { | 486 { |
488 ASSERT(isCurrentThread()); | 487 ASSERT(isCurrentThread()); |
489 blink::Platform::current()->didStopWorkerRunLoop(WebWorkerRunLoop(this)); | 488 blink::Platform::current()->didStopWorkerRunLoop(); |
490 } | 489 } |
491 | 490 |
492 void WorkerThread::terminateAndWaitForAllWorkers() | 491 void WorkerThread::terminateAndWaitForAllWorkers() |
493 { | 492 { |
494 // Keep this lock to prevent WorkerThread instances from being destroyed. | 493 // Keep this lock to prevent WorkerThread instances from being destroyed. |
495 MutexLocker lock(threadSetMutex()); | 494 MutexLocker lock(threadSetMutex()); |
496 HashSet<WorkerThread*> threads = workerThreads(); | 495 HashSet<WorkerThread*> threads = workerThreads(); |
497 for (WorkerThread* thread : threads) | 496 for (WorkerThread* thread : threads) |
498 thread->stopInShutdownSequence(); | 497 thread->stopInShutdownSequence(); |
499 | 498 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 569 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
571 } | 570 } |
572 | 571 |
573 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 572 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
574 { | 573 { |
575 MutexLocker locker(m_workerInspectorControllerMutex); | 574 MutexLocker locker(m_workerInspectorControllerMutex); |
576 m_workerInspectorController = workerInspectorController; | 575 m_workerInspectorController = workerInspectorController; |
577 } | 576 } |
578 | 577 |
579 } // namespace blink | 578 } // namespace blink |
OLD | NEW |