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 |