OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 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 20 matching lines...) Expand all Loading... |
31 #ifndef WebEmbeddedWorkerImpl_h | 31 #ifndef WebEmbeddedWorkerImpl_h |
32 #define WebEmbeddedWorkerImpl_h | 32 #define WebEmbeddedWorkerImpl_h |
33 | 33 |
34 #include "core/workers/WorkerLoaderProxy.h" | 34 #include "core/workers/WorkerLoaderProxy.h" |
35 | 35 |
36 #include "public/web/WebContentSecurityPolicy.h" | 36 #include "public/web/WebContentSecurityPolicy.h" |
37 #include "public/web/WebDevToolsAgentClient.h" | 37 #include "public/web/WebDevToolsAgentClient.h" |
38 #include "public/web/WebEmbeddedWorker.h" | 38 #include "public/web/WebEmbeddedWorker.h" |
39 #include "public/web/WebEmbeddedWorkerStartData.h" | 39 #include "public/web/WebEmbeddedWorkerStartData.h" |
40 #include "public/web/WebFrameClient.h" | 40 #include "public/web/WebFrameClient.h" |
| 41 #include <memory> |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 class ServiceWorkerGlobalScopeProxy; | 45 class ServiceWorkerGlobalScopeProxy; |
45 class WebLocalFrameImpl; | 46 class WebLocalFrameImpl; |
46 class WebServiceWorkerNetworkProvider; | 47 class WebServiceWorkerNetworkProvider; |
47 class WebView; | 48 class WebView; |
48 class WorkerInspectorProxy; | 49 class WorkerInspectorProxy; |
49 class WorkerScriptLoader; | 50 class WorkerScriptLoader; |
50 class WorkerThread; | 51 class WorkerThread; |
51 | 52 |
52 class WebEmbeddedWorkerImpl final | 53 class WebEmbeddedWorkerImpl final |
53 : public WebEmbeddedWorker | 54 : public WebEmbeddedWorker |
54 , public WebFrameClient | 55 , public WebFrameClient |
55 , public WebDevToolsAgentClient | 56 , public WebDevToolsAgentClient |
56 , private WorkerLoaderProxyProvider { | 57 , private WorkerLoaderProxyProvider { |
57 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); | 58 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); |
58 public: | 59 public: |
59 WebEmbeddedWorkerImpl(PassOwnPtr<WebServiceWorkerContextClient>, PassOwnPtr<
WebWorkerContentSettingsClientProxy>); | 60 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, std::u
nique_ptr<WebWorkerContentSettingsClientProxy>); |
60 ~WebEmbeddedWorkerImpl() override; | 61 ~WebEmbeddedWorkerImpl() override; |
61 | 62 |
62 // WebEmbeddedWorker overrides. | 63 // WebEmbeddedWorker overrides. |
63 void startWorkerContext(const WebEmbeddedWorkerStartData&) override; | 64 void startWorkerContext(const WebEmbeddedWorkerStartData&) override; |
64 void terminateWorkerContext() override; | 65 void terminateWorkerContext() override; |
65 void resumeAfterDownload() override; | 66 void resumeAfterDownload() override; |
66 void attachDevTools(const WebString& hostId, int sessionId) override; | 67 void attachDevTools(const WebString& hostId, int sessionId) override; |
67 void reattachDevTools(const WebString& hostId, int sessionId, const WebStrin
g& savedState) override; | 68 void reattachDevTools(const WebString& hostId, int sessionId, const WebStrin
g& savedState) override; |
68 void detachDevTools() override; | 69 void detachDevTools() override; |
69 void dispatchDevToolsMessage(int sessionId, int callId, const WebString& met
hod, const WebString& message) override; | 70 void dispatchDevToolsMessage(int sessionId, int callId, const WebString& met
hod, const WebString& message) override; |
(...skipping 18 matching lines...) Expand all Loading... |
88 | 89 |
89 void onScriptLoaderFinished(); | 90 void onScriptLoaderFinished(); |
90 void startWorkerThread(); | 91 void startWorkerThread(); |
91 | 92 |
92 // WorkerLoaderProxyProvider | 93 // WorkerLoaderProxyProvider |
93 void postTaskToLoader(std::unique_ptr<ExecutionContextTask>) override; | 94 void postTaskToLoader(std::unique_ptr<ExecutionContextTask>) override; |
94 bool postTaskToWorkerGlobalScope(std::unique_ptr<ExecutionContextTask>) over
ride; | 95 bool postTaskToWorkerGlobalScope(std::unique_ptr<ExecutionContextTask>) over
ride; |
95 | 96 |
96 WebEmbeddedWorkerStartData m_workerStartData; | 97 WebEmbeddedWorkerStartData m_workerStartData; |
97 | 98 |
98 OwnPtr<WebServiceWorkerContextClient> m_workerContextClient; | 99 std::unique_ptr<WebServiceWorkerContextClient> m_workerContextClient; |
99 | 100 |
100 // This is kept until startWorkerContext is called, and then passed on | 101 // This is kept until startWorkerContext is called, and then passed on |
101 // to WorkerContext. | 102 // to WorkerContext. |
102 OwnPtr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient; | 103 std::unique_ptr<WebWorkerContentSettingsClientProxy> m_contentSettingsClient
; |
103 | 104 |
104 // We retain ownership of this one which is for use on the | 105 // We retain ownership of this one which is for use on the |
105 // main thread only. | 106 // main thread only. |
106 OwnPtr<WebServiceWorkerNetworkProvider> m_networkProvider; | 107 std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider; |
107 | 108 |
108 // Kept around only while main script loading is ongoing. | 109 // Kept around only while main script loading is ongoing. |
109 RefPtr<WorkerScriptLoader> m_mainScriptLoader; | 110 RefPtr<WorkerScriptLoader> m_mainScriptLoader; |
110 | 111 |
111 OwnPtr<WorkerThread> m_workerThread; | 112 std::unique_ptr<WorkerThread> m_workerThread; |
112 RefPtr<WorkerLoaderProxy> m_loaderProxy; | 113 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
113 Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; | 114 Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; |
114 Persistent<WorkerInspectorProxy> m_workerInspectorProxy; | 115 Persistent<WorkerInspectorProxy> m_workerInspectorProxy; |
115 | 116 |
116 // 'shadow page' - created to proxy loading requests from the worker. | 117 // 'shadow page' - created to proxy loading requests from the worker. |
117 // Both WebView and WebFrame objects are close()'ed (where they're | 118 // Both WebView and WebFrame objects are close()'ed (where they're |
118 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they | 119 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they |
119 // are guaranteed to exist while this object is around. | 120 // are guaranteed to exist while this object is around. |
120 WebView* m_webView; | 121 WebView* m_webView; |
121 Persistent<WebLocalFrameImpl> m_mainFrame; | 122 Persistent<WebLocalFrameImpl> m_mainFrame; |
(...skipping 11 matching lines...) Expand all Loading... |
133 DoPauseAfterDownload, | 134 DoPauseAfterDownload, |
134 IsPausedAfterDownload | 135 IsPausedAfterDownload |
135 } m_pauseAfterDownloadState; | 136 } m_pauseAfterDownloadState; |
136 | 137 |
137 WaitingForDebuggerState m_waitingForDebuggerState; | 138 WaitingForDebuggerState m_waitingForDebuggerState; |
138 }; | 139 }; |
139 | 140 |
140 } // namespace blink | 141 } // namespace blink |
141 | 142 |
142 #endif // WebEmbeddedWorkerImpl_h | 143 #endif // WebEmbeddedWorkerImpl_h |
OLD | NEW |