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

Unified Diff: content/child/service_worker/service_worker_dispatcher.h

Issue 1011643002: ServiceWorker: Introduce SWMessageSender in order to mock IPC messaging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add header comment Created 5 years, 9 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 | « no previous file | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/service_worker/service_worker_dispatcher.h
diff --git a/content/child/service_worker/service_worker_dispatcher.h b/content/child/service_worker/service_worker_dispatcher.h
index 775c16b3d1d0d8bf87abdca3750cb30d6ec048e0..4102943974c73c98d9691bd048053ff041e42947 100644
--- a/content/child/service_worker/service_worker_dispatcher.h
+++ b/content/child/service_worker/service_worker_dispatcher.h
@@ -28,7 +28,7 @@ class Message;
namespace content {
-class ServiceWorkerMessageFilter;
+class ServiceWorkerMessageSender;
class ServiceWorkerProviderContext;
class ThreadSafeSender;
class WebServiceWorkerImpl;
@@ -41,7 +41,8 @@ struct TransferredMessagePort;
// This class manages communication with the browser process about
// registration of the service worker, exposed to renderer and worker
// scripts through methods like navigator.registerServiceWorker().
-class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
+class CONTENT_EXPORT ServiceWorkerDispatcher
+ : public WorkerTaskRunner::Observer {
public:
typedef blink::WebServiceWorkerProvider::WebServiceWorkerRegistrationCallbacks
WebServiceWorkerRegistrationCallbacks;
@@ -55,11 +56,10 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
WebServiceWorkerGetRegistrationForReadyCallbacks
WebServiceWorkerGetRegistrationForReadyCallbacks;
- explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender);
+ explicit ServiceWorkerDispatcher(ServiceWorkerMessageSender* sender);
~ServiceWorkerDispatcher() override;
void OnMessageReceived(const IPC::Message& msg);
- bool Send(IPC::Message* msg);
// Corresponds to navigator.serviceWorker.register()
void RegisterServiceWorker(
@@ -128,10 +128,10 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
const ServiceWorkerRegistrationObjectInfo& info,
bool adopt_handle);
- // |thread_safe_sender| needs to be passed in because if the call leads to
- // construction it will be needed.
+ // |sender| needs to be passed in because if the call leads to construction
+ // it will be needed.
static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance(
- ThreadSafeSender* thread_safe_sender);
+ ServiceWorkerMessageSender* sender);
// Unlike GetOrCreateThreadSpecificInstance() this doesn't create a new
// instance if thread-local instance doesn't exist.
@@ -155,6 +155,7 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
typedef std::map<int, WebServiceWorkerRegistrationImpl*>
RegistrationObjectMap;
+ friend class ServiceWorkerDispatcherTest;
friend class WebServiceWorkerImpl;
friend class WebServiceWorkerRegistrationImpl;
@@ -252,7 +253,7 @@ class ServiceWorkerDispatcher : public WorkerTaskRunner::Observer {
// (e.g. as .current).
WorkerToProviderMap worker_to_provider_;
- scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+ scoped_refptr<ServiceWorkerMessageSender> sender_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
};
« no previous file with comments | « no previous file | content/child/service_worker/service_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698