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

Unified Diff: content/browser/shared_worker/shared_worker_host.h

Issue 182693002: Implement some mothods in SharedWorkerHost and SharedWorkerServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added null check of instance in SharedWorkerHost Created 6 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 | « no previous file | content/browser/shared_worker/shared_worker_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/shared_worker/shared_worker_host.h
diff --git a/content/browser/shared_worker/shared_worker_host.h b/content/browser/shared_worker/shared_worker_host.h
index b12487c7fd392391815f7cab383e4bff60bf1037..cc4c2473d1bd3a3e707111bf02acc4cb9d6e1a82 100644
--- a/content/browser/shared_worker/shared_worker_host.h
+++ b/content/browser/shared_worker/shared_worker_host.h
@@ -8,6 +8,14 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "base/strings/string16.h"
+#include "content/browser/shared_worker/shared_worker_message_filter.h"
+
+class GURL;
+
+namespace IPC {
+class Message;
+}
namespace content {
class SharedWorkerMessageFilter;
@@ -20,17 +28,60 @@ class SharedWorkerHost {
explicit SharedWorkerHost(SharedWorkerInstance* instance);
~SharedWorkerHost();
+ // Sends |message| to the SharedWorker.
+ bool Send(IPC::Message* message);
+
// Starts the SharedWorker in the renderer process which is associated with
// |filter|.
void Init(SharedWorkerMessageFilter* filter);
+ // Returns true iff the given message from a renderer process was forwarded to
+ // the worker.
+ bool FilterMessage(const IPC::Message& message,
+ SharedWorkerMessageFilter* filter);
+
+ // Handles the shutdown of the filter. If the worker has no other client,
+ // sends TerminateWorkerContext message to shut it down.
+ void FilterShutdown(SharedWorkerMessageFilter* filter);
+
+ // Shuts down any shared workers that are no longer referenced by active
+ // documents.
+ void DocumentDetached(SharedWorkerMessageFilter* filter,
+ unsigned long long document_id);
+
+ void WorkerContextClosed();
+ void WorkerScriptLoaded();
+ void WorkerScriptLoadFailed();
+ void WorkerConnected(int message_port_id);
+ void WorkerContextDestroyed();
+ void AllowDatabase(const GURL& url,
+ const base::string16& name,
+ const base::string16& display_name,
+ unsigned long estimated_size,
+ bool* result);
+ void AllowFileSystem(const GURL& url, bool* result);
+ void AllowIndexedDB(const GURL& url,
+ const base::string16& name,
+ bool* result);
+
SharedWorkerInstance* instance() { return instance_.get(); }
+ SharedWorkerMessageFilter* container_render_filter() const {
+ return container_render_filter_;
+ }
+ int process_id() const {
+ return container_render_filter_->render_process_id();
+ }
int worker_route_id() const { return worker_route_id_; }
private:
+ // Relays |message| to the SharedWorker. Takes care of parsing the message if
+ // it contains a message port and sending it a valid route id.
+ void RelayMessage(const IPC::Message& message,
+ SharedWorkerMessageFilter* incoming_filter);
+
scoped_ptr<SharedWorkerInstance> instance_;
+ SharedWorkerMessageFilter* container_render_filter_;
int worker_route_id_;
-
DISALLOW_COPY_AND_ASSIGN(SharedWorkerHost);
};
} // namespace content
« no previous file with comments | « no previous file | content/browser/shared_worker/shared_worker_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698