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

Unified Diff: content/renderer/service_worker/embedded_worker_dispatcher.h

Issue 54573002: Initial child-process side plumbing for starting an embedded ServiceWorker context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month 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/renderer/service_worker/embedded_worker_dispatcher.h
diff --git a/content/renderer/service_worker/embedded_worker_dispatcher.h b/content/renderer/service_worker/embedded_worker_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..d4dd6626c5ab04ea8df01a545b9a6c1edf27bfa0
--- /dev/null
+++ b/content/renderer/service_worker/embedded_worker_dispatcher.h
@@ -0,0 +1,49 @@
+// 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_EMBEDDED_WORKER_DISPATCHER_H_
+#define CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
+
+#include "base/basictypes.h"
+#include "base/id_map.h"
+#include "base/memory/weak_ptr.h"
+#include "ipc/ipc_listener.h"
+
+struct ServiceWorkerMsg_StartWorker_Params;
+class GURL;
+
+namespace WebKit {
+class WebEmbeddedWorker;
+}
+
+namespace content {
+
+// A tiny dispatcher which handles embedded worker start/stop messages.
+class EmbeddedWorkerDispatcher : public IPC::Listener {
+ public:
+ EmbeddedWorkerDispatcher();
+ virtual ~EmbeddedWorkerDispatcher();
+
+ // IPC::Listener overrides.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ void WorkerContextDestroyed(int embedded_worker_id);
+
+ private:
+ class WorkerWrapper;
+
+ void OnStartWorker(int embedded_worker_id,
+ int64 service_worker_version_id,
+ const GURL& script_url);
+ void OnTerminateWorker(int embedded_worker_id);
+
+ IDMap<WorkerWrapper, IDMapOwnPointer> workers_;
+ base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
« no previous file with comments | « content/renderer/service_worker/OWNERS ('k') | content/renderer/service_worker/embedded_worker_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698