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

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

Issue 140893002: Adding slightly clearer separation between SW and EmbeddedWorker (still incomplete) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added TODO to filter messages on the browser side Created 6 years, 11 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/renderer/service_worker/service_worker_script_context.h
diff --git a/content/renderer/service_worker/service_worker_script_context.h b/content/renderer/service_worker/service_worker_script_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..86f1d8e5edc5fc390b4dc6f1a36f3b5106559904
--- /dev/null
+++ b/content/renderer/service_worker/service_worker_script_context.h
@@ -0,0 +1,53 @@
+// Copyright 2014 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_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_
+#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_
+
+#include "base/basictypes.h"
+
+namespace blink {
+class WebServiceWorkerContextProxy;
+}
+
+namespace IPC {
+class Message;
+}
+
+namespace content {
+
+class EmbeddedWorkerContextClient;
+struct ServiceWorkerFetchRequest;
+
+// TODO(kinuko): This should implement WebServiceWorkerContextClient
+// rather than having EmbeddedWorkerContextClient implement it.
+// See the header comment in embedded_worker_context_client.h for the
+// potential EW/SW layering concerns.
+class ServiceWorkerScriptContext {
+ public:
+ ServiceWorkerScriptContext(
+ EmbeddedWorkerContextClient* embedded_context,
+ blink::WebServiceWorkerContextProxy* proxy);
+ ~ServiceWorkerScriptContext();
+
+ void OnMessageReceived(const IPC::Message& message);
+
+ private:
+ // Send message back to the browser.
+ void Send(const IPC::Message& message);
+
+ void OnFetchEvent(const ServiceWorkerFetchRequest& request);
+
+ // Not owned; embedded_context_ owns this.
+ EmbeddedWorkerContextClient* embedded_context_;
+
+ // Not owned; this object is destroyed when proxy_ becomes invalid.
+ blink::WebServiceWorkerContextProxy* proxy_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698