Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: third_party/WebKit/Source/web/WebIsolatedWorkerImpl.h

Issue 2118243002: [proof-of-concept] SW thread independent of the main thread Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebIsolatedWorkerImpl.h
diff --git a/third_party/WebKit/Source/web/WebIsolatedWorkerImpl.h b/third_party/WebKit/Source/web/WebIsolatedWorkerImpl.h
new file mode 100644
index 0000000000000000000000000000000000000000..7b14f0451f908e8b78f9f5f994c952c546791d4b
--- /dev/null
+++ b/third_party/WebKit/Source/web/WebIsolatedWorkerImpl.h
@@ -0,0 +1,67 @@
+
+#ifndef WebIsolatedWorkerImpl_h
+#define WebIsolatedWorkerImpl_h
+
+#include <memory>
+
+#include "core/workers/WorkerLoaderProxy.h"
+#include "public/platform/WebCommon.h"
+#include "public/web/modules/serviceworker/WebIsolatedWorker.h"
+#include "public/web/WebFrameClient.h"
+
+namespace blink {
+
+class WebIsolatedWorkerContextClient;
+class WorkerBackingThread;
+class WebView;
+class WebLocalFrameImpl;
+class IsolatedWorkerThread;
+class IsolatedWorkerReportingProxy;
+
+class WebIsolatedWorkerImpl : public WebIsolatedWorker {
+public:
+ WebIsolatedWorkerImpl(std::unique_ptr<WebIsolatedWorkerContextClient>);
+ ~WebIsolatedWorkerImpl() override;
+ void startWorker(int64_t versionID, WebURL scopeURL, WebURL scriptURL) override;
+ IsolatedWorkerThread* thread() { return m_workerThread.get(); }
+
+private:
+ class MainThreadProxy final : public ThreadSafeRefCounted<MainThreadProxy>, public WebFrameClient, public WorkerLoaderProxyProvider {
+ public:
+ MainThreadProxy(WebIsolatedWorkerImpl* worker, KURL scopeURL);
+ ~MainThreadProxy();
+ void detach();
+
+ private:
+ void initializeOnMainThread(KURL scopeURL);
+
+ // WorkerLoaderProxyProvider
+ void postTaskToLoader(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask>) override;
+ void postTaskToWorkerGlobalScope(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask>) override;
+
+ // WebFrameClient overrides.
+ void willSendRequest(WebLocalFrame*, WebURLRequest&) override;
+ void didFinishDocumentLoad(WebLocalFrame*) override;
+
+ Mutex m_lock_for_worker;
+ Mutex m_lock_for_document;
+ WebIsolatedWorkerImpl* m_worker = nullptr;
+ KURL m_scopeURL;
+ WebView* m_webView = nullptr;
+ Persistent<WebLocalFrameImpl> m_mainFrame;
+ bool m_shadowPageLoadStarted = false;
+ bool m_shadowPageLoaded = false;
+ std::vector<std::unique_ptr<ExecutionContextTask>> m_pending_tasks;
+ };
+
+ std::unique_ptr<WorkerBackingThread> m_workerBackingThread;
+
+ RefPtr<MainThreadProxy> m_mainThreadProxy;
+ RefPtr<WorkerLoaderProxy> m_loaderProxy;
+ std::unique_ptr<IsolatedWorkerReportingProxy> m_workerGlobalScopeProxy;
+ std::unique_ptr<IsolatedWorkerThread> m_workerThread;
+};
+
+} // namespace blink
+
+#endif // WebIsolatedWorkerImpl_h
« no previous file with comments | « third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp ('k') | third_party/WebKit/Source/web/WebIsolatedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698