OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "WebWorkerBase.h" | 31 #include "WebWorkerBase.h" |
32 #include "core/dom/CrossThreadTask.h" | 32 #include "core/dom/CrossThreadTask.h" |
33 #include "core/platform/CrossThreadCopier.h" | 33 #include "core/platform/CrossThreadCopier.h" |
34 #include "core/workers/WorkerContext.h" | 34 #include "core/workers/WorkerGlobalScope.h" |
35 | 35 |
36 namespace WebKit { | 36 namespace WebKit { |
37 | 37 |
38 // Base class for worker thread bridges. This class adds an observer to | 38 // Base class for worker thread bridges. This class adds an observer to |
39 // WorkerContext so that it doesn't try to use deleted pointers when | 39 // WorkerGlobalScope so that it doesn't try to use deleted pointers when |
40 // WorkerContext is destroyed. | 40 // WorkerGlobalScope is destroyed. |
41 class WorkerAllowMainThreadBridgeBase : public ThreadSafeRefCounted<WorkerAllowM
ainThreadBridgeBase> { | 41 class WorkerAllowMainThreadBridgeBase : public ThreadSafeRefCounted<WorkerAllowM
ainThreadBridgeBase> { |
42 WTF_MAKE_NONCOPYABLE(WorkerAllowMainThreadBridgeBase); | 42 WTF_MAKE_NONCOPYABLE(WorkerAllowMainThreadBridgeBase); |
43 public: | 43 public: |
44 WorkerAllowMainThreadBridgeBase(WebCore::WorkerContext*, WebWorkerBase*); | 44 WorkerAllowMainThreadBridgeBase(WebCore::WorkerGlobalScope*, WebWorkerBase*)
; |
45 | 45 |
46 virtual ~WorkerAllowMainThreadBridgeBase() | 46 virtual ~WorkerAllowMainThreadBridgeBase() |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 // This class is passed across threads, so subclasses if it should make sure | 50 // This class is passed across threads, so subclasses if it should make sure |
51 // any string fields are copied. | 51 // any string fields are copied. |
52 class AllowParams { | 52 class AllowParams { |
53 public: | 53 public: |
54 AllowParams(const String& mode) | 54 AllowParams(const String& mode) |
(...skipping 24 matching lines...) Expand all Loading... |
79 | 79 |
80 protected: | 80 protected: |
81 void postTaskToMainThread(PassOwnPtr<AllowParams>); | 81 void postTaskToMainThread(PassOwnPtr<AllowParams>); |
82 | 82 |
83 private: | 83 private: |
84 static void allowTask(WebCore::ScriptExecutionContext*, PassOwnPtr<AllowPara
ms>, PassRefPtr<WorkerAllowMainThreadBridgeBase>); | 84 static void allowTask(WebCore::ScriptExecutionContext*, PassOwnPtr<AllowPara
ms>, PassRefPtr<WorkerAllowMainThreadBridgeBase>); |
85 static void didComplete(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerA
llowMainThreadBridgeBase>, bool); | 85 static void didComplete(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerA
llowMainThreadBridgeBase>, bool); |
86 | 86 |
87 Mutex m_mutex; | 87 Mutex m_mutex; |
88 WebWorkerBase* m_webWorkerBase; | 88 WebWorkerBase* m_webWorkerBase; |
89 WebCore::WorkerContext::Observer* m_workerContextObserver; | 89 WebCore::WorkerGlobalScope::Observer* m_workerGlobalScopeObserver; |
90 bool m_result; | 90 bool m_result; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace WebKit | 93 } // namespace WebKit |
94 | 94 |
OLD | NEW |