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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #include "core/workers/WorkerThread.h" | 27 #include "core/workers/WorkerThread.h" |
28 | 28 |
| 29 #include <limits.h> |
| 30 #include <memory> |
29 #include "bindings/core/v8/Microtask.h" | 31 #include "bindings/core/v8/Microtask.h" |
30 #include "bindings/core/v8/ScriptSourceCode.h" | 32 #include "bindings/core/v8/ScriptSourceCode.h" |
31 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 33 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
32 #include "core/inspector/ConsoleMessageStorage.h" | 34 #include "core/inspector/ConsoleMessageStorage.h" |
33 #include "core/inspector/InspectorInstrumentation.h" | 35 #include "core/inspector/InspectorInstrumentation.h" |
34 #include "core/inspector/InspectorTaskRunner.h" | 36 #include "core/inspector/InspectorTaskRunner.h" |
35 #include "core/inspector/WorkerInspectorController.h" | 37 #include "core/inspector/WorkerInspectorController.h" |
36 #include "core/inspector/WorkerThreadDebugger.h" | 38 #include "core/inspector/WorkerThreadDebugger.h" |
37 #include "core/origin_trials/OriginTrialContext.h" | 39 #include "core/origin_trials/OriginTrialContext.h" |
38 #include "core/workers/ThreadedWorkletGlobalScope.h" | 40 #include "core/workers/ThreadedWorkletGlobalScope.h" |
39 #include "core/workers/WorkerBackingThread.h" | 41 #include "core/workers/WorkerBackingThread.h" |
40 #include "core/workers/WorkerClients.h" | 42 #include "core/workers/WorkerClients.h" |
41 #include "core/workers/WorkerGlobalScope.h" | 43 #include "core/workers/WorkerGlobalScope.h" |
42 #include "core/workers/WorkerReportingProxy.h" | 44 #include "core/workers/WorkerReportingProxy.h" |
43 #include "core/workers/WorkerThreadStartupData.h" | 45 #include "core/workers/WorkerThreadStartupData.h" |
44 #include "platform/CrossThreadFunctional.h" | 46 #include "platform/CrossThreadFunctional.h" |
45 #include "platform/Histogram.h" | 47 #include "platform/Histogram.h" |
46 #include "platform/WaitableEvent.h" | 48 #include "platform/WaitableEvent.h" |
47 #include "platform/WebThreadSupportingGC.h" | 49 #include "platform/WebThreadSupportingGC.h" |
48 #include "platform/heap/SafePoint.h" | 50 #include "platform/heap/SafePoint.h" |
49 #include "platform/heap/ThreadState.h" | 51 #include "platform/heap/ThreadState.h" |
50 #include "platform/weborigin/KURL.h" | 52 #include "platform/weborigin/KURL.h" |
51 #include "wtf/Functional.h" | 53 #include "wtf/Functional.h" |
52 #include "wtf/Noncopyable.h" | 54 #include "wtf/Noncopyable.h" |
53 #include "wtf/PtrUtil.h" | 55 #include "wtf/PtrUtil.h" |
54 #include "wtf/Threading.h" | 56 #include "wtf/Threading.h" |
55 #include "wtf/text/WTFString.h" | 57 #include "wtf/text/WTFString.h" |
56 #include <limits.h> | |
57 #include <memory> | |
58 | 58 |
59 namespace blink { | 59 namespace blink { |
60 | 60 |
61 using ExitCode = WorkerThread::ExitCode; | 61 using ExitCode = WorkerThread::ExitCode; |
62 | 62 |
63 // TODO(nhiroki): Adjust the delay based on UMA. | 63 // TODO(nhiroki): Adjust the delay based on UMA. |
64 const long long kForcibleTerminationDelayInMs = 2000; // 2 secs | 64 const long long kForcibleTerminationDelayInMs = 2000; // 2 secs |
65 | 65 |
66 static Mutex& threadSetMutex() { | 66 static Mutex& threadSetMutex() { |
67 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); | 67 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 MutexLocker lock(m_threadStateMutex); | 645 MutexLocker lock(m_threadStateMutex); |
646 return m_requestedToTerminate; | 646 return m_requestedToTerminate; |
647 } | 647 } |
648 | 648 |
649 ExitCode WorkerThread::getExitCodeForTesting() { | 649 ExitCode WorkerThread::getExitCodeForTesting() { |
650 MutexLocker lock(m_threadStateMutex); | 650 MutexLocker lock(m_threadStateMutex); |
651 return m_exitCode; | 651 return m_exitCode; |
652 } | 652 } |
653 | 653 |
654 } // namespace blink | 654 } // namespace blink |
OLD | NEW |