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