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

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

Issue 2721543002: SharedWorker: Factor out WorkerReportingProxy impl from WebSharedWorkerImpl (Closed)
Patch Set: fix compile failures on win bots Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebSharedWorkerImpl.h
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
index d32b805083aff54781de70d8e7cc339fdb433adf..098323c6ef1b8158c9acda14f383265a8231c6ae 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
@@ -36,13 +36,13 @@
#include <memory>
#include "core/dom/ExecutionContext.h"
#include "core/workers/WorkerLoaderProxy.h"
-#include "core/workers/WorkerReportingProxy.h"
#include "core/workers/WorkerThread.h"
#include "public/platform/WebAddressSpace.h"
#include "public/platform/WebContentSecurityPolicy.h"
#include "public/web/WebDevToolsAgentClient.h"
#include "public/web/WebFrameClient.h"
#include "public/web/WebSharedWorkerClient.h"
+#include "web/WebSharedWorkerReportingProxyImpl.h"
#include "wtf/RefPtr.h"
namespace blink {
@@ -60,35 +60,16 @@ class WorkerInspectorProxy;
class WorkerScriptLoader;
// This class is used by the worker process code to talk to the SharedWorker
-// implementation.
-// It can't use it directly since it uses WebKit types, so this class converts
-// the data types. When the SharedWorker object wants to call
-// WorkerReportingProxy, this class will convert to Chrome data types first and
-// then call the supplied WebCommonWorkerClient.
-class WebSharedWorkerImpl final : public WorkerReportingProxy,
- public WebFrameClient,
+// implementation. This is basically accessed on the main thread, but some
+// methods can be called from a worker thread. Such methods are suffixed with
+// *OnWorkerThread or have header comments.
+class WebSharedWorkerImpl final : public WebFrameClient,
public WebSharedWorker,
public WebDevToolsAgentClient,
private WorkerLoaderProxyProvider {
public:
explicit WebSharedWorkerImpl(WebSharedWorkerClient*);
- // WorkerReportingProxy methods:
- void countFeature(UseCounter::Feature) override;
- void countDeprecation(UseCounter::Feature) override;
- void reportException(const WTF::String&,
- std::unique_ptr<SourceLocation>,
- int exceptionId) override;
- void reportConsoleMessage(MessageSource,
- MessageLevel,
- const String& message,
- SourceLocation*) override;
- void postMessageToPageInspector(const WTF::String&) override;
- void didEvaluateWorkerScript(bool success) override {}
- void didCloseWorkerGlobalScope() override;
- void willDestroyWorkerGlobalScope() override {}
- void didTerminateWorkerThread() override;
-
// WebFrameClient methods to support resource loading thru the 'shadow page'.
WebApplicationCacheHost* createApplicationCacheHost(
WebApplicationCacheHostClient*) override;
@@ -126,6 +107,12 @@ class WebSharedWorkerImpl final : public WorkerReportingProxy,
const WebString& method,
const WebString& message) override;
+ // Callback methods for WebSharedWorkerReportingProxyImpl.
+ void countFeature(UseCounter::Feature);
+ void postMessageToPageInspector(const String& message);
+ void didCloseWorkerGlobalScope();
+ void didTerminateWorkerThread();
+
private:
~WebSharedWorkerImpl() override;
@@ -141,15 +128,11 @@ class WebSharedWorkerImpl final : public WorkerReportingProxy,
void didReceiveScriptLoaderResponse();
void onScriptLoaderFinished();
- void connectTask(WebMessagePortChannelUniquePtr);
-
- // Tasks that are run on the main thread.
- void didCloseWorkerGlobalScopeOnMainThread();
- void didTerminateWorkerThreadOnMainThread();
-
- void postMessageToPageInspectorOnMainThread(const String& message);
+ void connectTaskOnWorkerThread(WebMessagePortChannelUniquePtr);
// WorkerLoaderProxyProvider
+ // postTaskToLoader() and getLoaderExecutionContext() can be called from a
kinuko 2017/02/28 00:19:16 getLoaderExecutionContext must be called on the ma
nhiroki 2017/02/28 01:09:22 Added DCHECK(isMainThread()) in getLoaderExecution
+ // worker thread.
void postTaskToLoader(const WebTraceLocation&,
std::unique_ptr<WTF::CrossThreadClosure>) override;
void postTaskToWorkerGlobalScope(
@@ -164,7 +147,6 @@ class WebSharedWorkerImpl final : public WorkerReportingProxy,
Persistent<WebLocalFrameImpl> m_mainFrame;
bool m_askedToTerminate;
- // This one is bound to and used only on the main thread.
std::unique_ptr<WebServiceWorkerNetworkProvider> m_networkProvider;
Persistent<WorkerInspectorProxy> m_workerInspectorProxy;
@@ -172,6 +154,7 @@ class WebSharedWorkerImpl final : public WorkerReportingProxy,
// Owned by the main thread, but will be accessed by the worker.
CrossThreadPersistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
+ Persistent<WebSharedWorkerReportingProxyImpl> m_reportingProxy;
std::unique_ptr<WorkerThread> m_workerThread;
WebSharedWorkerClient* m_client;
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698