summaryrefslogtreecommitdiffstats
path: root/chrome/browser/worker_host/worker_process_host.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/worker_host/worker_process_host.h')
-rw-r--r--chrome/browser/worker_host/worker_process_host.h53
1 files changed, 16 insertions, 37 deletions
diff --git a/chrome/browser/worker_host/worker_process_host.h b/chrome/browser/worker_host/worker_process_host.h
index 1834725..b5a8d74f 100644
--- a/chrome/browser/worker_host/worker_process_host.h
+++ b/chrome/browser/worker_host/worker_process_host.h
@@ -9,12 +9,16 @@
#include "base/basictypes.h"
#include "base/task.h"
+#include "chrome/browser/worker_host/worker_document_set.h"
#include "chrome/common/child_process_host.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_channel.h"
+struct ViewHostMsg_CreateWorker_Params;
+
class WorkerProcessHost : public ChildProcessHost {
public:
+
// Contains information about each worker instance, needed to forward messages
// between the renderer and worker processes.
class WorkerInstance {
@@ -23,8 +27,6 @@ class WorkerProcessHost : public ChildProcessHost {
bool shared,
bool off_the_record,
const string16& name,
- int renderer_id,
- int render_view_route_id,
int worker_route_id);
// Unique identifier for a worker client.
@@ -35,6 +37,7 @@ class WorkerProcessHost : public ChildProcessHost {
void RemoveSender(IPC::Message::Sender* sender, int sender_route_id);
void RemoveSenders(IPC::Message::Sender* sender);
bool HasSender(IPC::Message::Sender* sender, int sender_route_id) const;
+ bool RendererIsParent(int renderer_id, int render_view_route_id) const;
int NumSenders() const { return senders_.size(); }
// Returns the single sender (must only be one).
SenderInfo GetSender() const;
@@ -45,31 +48,13 @@ class WorkerProcessHost : public ChildProcessHost {
bool Matches(
const GURL& url, const string16& name, bool off_the_record) const;
- // Adds a document to a shared worker's document set.
- void AddToDocumentSet(IPC::Message::Sender* parent,
- unsigned long long document_id);
-
- // Checks to see if a document is in a shared worker's document set.
- bool IsInDocumentSet(IPC::Message::Sender* parent,
- unsigned long long document_id) const;
-
- // Removes a specific document from a shared worker's document set when
- // that document is detached.
- void RemoveFromDocumentSet(IPC::Message::Sender* parent,
- unsigned long long document_id);
-
- // Copies the document set from one instance to another
- void CopyDocumentSet(const WorkerInstance& instance) {
- document_set_ = instance.document_set_;
+ // Shares the passed instance's WorkerDocumentSet with this instance. This
+ // instance's current WorkerDocumentSet is dereferenced (and freed if this
+ // is the only reference) as a result.
+ void ShareDocumentSet(const WorkerInstance& instance) {
+ worker_document_set_ = instance.worker_document_set_;
};
- // Invoked when a render process exits, to remove all associated documents
- // from a shared worker's document set.
- void RemoveAllAssociatedDocuments(IPC::Message::Sender* parent);
-
- bool IsDocumentSetEmpty() const { return document_set_.empty(); }
-
-
// Accessors
bool shared() const { return shared_; }
bool off_the_record() const { return off_the_record_; }
@@ -77,14 +62,12 @@ class WorkerProcessHost : public ChildProcessHost {
void set_closed(bool closed) { closed_ = closed; }
const GURL& url() const { return url_; }
const string16 name() const { return name_; }
- int renderer_id() const { return renderer_id_; }
- int render_view_route_id() const { return render_view_route_id_; }
int worker_route_id() const { return worker_route_id_; }
+ WorkerDocumentSet* worker_document_set() const {
+ return worker_document_set_;
+ }
private:
- // Unique identifier for an associated document.
- typedef std::pair<IPC::Message::Sender*, unsigned long long> DocumentInfo;
- typedef std::list<DocumentInfo> DocumentSet;
// Set of all senders (clients) associated with this worker.
typedef std::list<SenderInfo> SenderList;
GURL url_;
@@ -92,11 +75,9 @@ class WorkerProcessHost : public ChildProcessHost {
bool off_the_record_;
bool closed_;
string16 name_;
- int renderer_id_;
- int render_view_route_id_;
int worker_route_id_;
SenderList senders_;
- DocumentSet document_set_;
+ scoped_refptr<WorkerDocumentSet> worker_document_set_;
};
explicit WorkerProcessHost(ResourceDispatcherHost* resource_dispatcher_host);
@@ -142,6 +123,7 @@ class WorkerProcessHost : public ChildProcessHost {
void OnLookupSharedWorker(const GURL& url,
const string16& name,
unsigned long long document_id,
+ int render_view_route_id,
int* route_id,
bool* url_error);
@@ -161,10 +143,7 @@ class WorkerProcessHost : public ChildProcessHost {
// Updates the title shown in the task manager.
void UpdateTitle();
- void OnCreateWorker(const GURL& url,
- bool shared,
- const string16& name,
- int render_view_route_id,
+ void OnCreateWorker(const ViewHostMsg_CreateWorker_Params& params,
int* route_id);
void OnCancelCreateDedicatedWorker(int route_id);
void OnForwardToWorker(const IPC::Message& message);