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

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

Issue 25008006: Flush out initial [un]registerServiceWorker roundtrip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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: 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
new file mode 100644
index 0000000000000000000000000000000000000000..a9762a5e1216c359764dfbd8a03e277daff39bc7
--- /dev/null
+++ b/content/child/service_worker/service_worker_dispatcher.h
@@ -0,0 +1,67 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
+#define CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_
+
+#include "base/id_map.h"
+#include "base/memory/ref_counted.h"
+#include "base/strings/string16.h"
+#include "third_party/WebKit/public/platform/WebServiceWorkerRegistry.h"
+#include "webkit/child/worker_task_runner.h"
+
+class GURL;
+
+namespace IPC {
+class Message;
+}
+
+namespace content {
+class ThreadSafeSender;
+class ServiceWorkerMessageFilter;
+class WebServiceWorkerImpl;
+
+class ServiceWorkerDispatcher : public webkit_glue::WorkerTaskRunner::Observer {
+ public:
+ explicit ServiceWorkerDispatcher(ThreadSafeSender* thread_safe_sender,
+ ServiceWorkerMessageFilter* message_filter);
+ virtual ~ServiceWorkerDispatcher();
+
+ // webkit_glue::WorkerTaskRunner::Observer implementation.
+ virtual void OnWorkerRunLoopStopped() OVERRIDE;
+
+ void OnMessageReceived(const IPC::Message& msg);
+ bool Send(IPC::Message* msg);
+
+ void RegisterServiceWorker(
+ const string16& pattern,
+ const GURL& scriptUrl,
+ WebKit::WebServiceWorkerRegistry::WebServiceWorkerCallbacks* callbacks);
+ void UnregisterServiceWorker(
+ const string16& pattern,
+ WebKit::WebServiceWorkerRegistry::WebServiceWorkerCallbacks* callbacks);
+
+ // |thread_safe_sender| needs to be passed in because if the call leads to
+ // construction it will be needed.
+ static ServiceWorkerDispatcher* ThreadSpecificInstance(
+ ThreadSafeSender* thread_safe_sender,
+ ServiceWorkerMessageFilter* message_filter);
+
+ private:
+ void OnServiceWorkerRegistered(int32 request_id, int32 worker_id);
+ void OnServiceWorkerUnregistered(int32 request_id, int32 worker_id);
+
+ IDMap<WebKit::WebServiceWorkerRegistry::WebServiceWorkerCallbacks,
+ IDMapOwnPointer> pending_callbacks_;
+ IDMap<WebServiceWorkerImpl, IDMapOwnPointer> workers_;
kinuko 2013/09/30 12:41:17 (oh, ok these are all owned here)
+
+ scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+ scoped_refptr<ServiceWorkerMessageFilter> message_filter_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698