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

Unified Diff: content/browser/worker_host/worker_process_host.h

Issue 133093003: Move the worker script loading code to the worker process (phase:4/5) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02ScriptLoadInWorkerChrome
Patch Set: change comments in worker_webapplicationcachehost_impl.h and rebase. 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/browser/worker_host/worker_process_host.h
diff --git a/content/browser/worker_host/worker_process_host.h b/content/browser/worker_host/worker_process_host.h
index b555313ab0b42ee02ff92c5883883d3d55aa0b6b..2a70637fa2f77146c78a2298ed276b3b2cbd19b9 100644
--- a/content/browser/worker_host/worker_process_host.h
+++ b/content/browser/worker_host/worker_process_host.h
@@ -62,21 +62,26 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
const base::string16& content_security_policy,
blink::WebContentSecurityPolicyType security_policy_type,
int worker_route_id,
- int parent_process_id,
int render_frame_id,
- int64 main_resource_appcache_id,
- ResourceContext* resource_context,
- const WorkerStoragePartition& partition);
- // Used for pending instances. Rest of the parameters are ignored.
- WorkerInstance(const GURL& url,
- bool shared,
- const base::string16& name,
ResourceContext* resource_context,
const WorkerStoragePartition& partition);
~WorkerInstance();
// Unique identifier for a worker client.
- typedef std::pair<WorkerMessageFilter*, int> FilterInfo;
+ class FilterInfo {
+ public:
+ FilterInfo(WorkerMessageFilter* filter, int route_id)
+ : filter_(filter), route_id_(route_id), message_port_id_(0) { }
+ WorkerMessageFilter* filter() const { return filter_; }
+ int route_id() const { return route_id_; }
+ int message_port_id() const { return message_port_id_; }
+ void set_message_port_id(int id) { message_port_id_ = id; }
+
+ private:
+ WorkerMessageFilter* filter_;
+ int route_id_;
+ int message_port_id_;
+ };
// APIs to manage the filter list for a given instance.
void AddFilter(WorkerMessageFilter* filter, int route_id);
@@ -85,6 +90,9 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
bool HasFilter(WorkerMessageFilter* filter, int route_id) const;
bool FrameIsParent(int render_process_id, int render_frame_id) const;
int NumFilters() const { return filters_.size(); }
+ void SetMessagePortID(WorkerMessageFilter* filter,
+ int route_id,
+ int message_port_id);
// Returns the single filter (must only be one).
FilterInfo GetFilter() const;
@@ -119,11 +127,7 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
return security_policy_type_;
}
int worker_route_id() const { return worker_route_id_; }
- int parent_process_id() const { return parent_process_id_; }
int render_frame_id() const { return render_frame_id_; }
- int64 main_resource_appcache_id() const {
- return main_resource_appcache_id_;
- }
WorkerDocumentSet* worker_document_set() const {
return worker_document_set_.get();
}
@@ -133,6 +137,8 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
const WorkerStoragePartition& partition() const {
return partition_;
}
+ void set_load_failed(bool failed) { load_failed_ = failed; }
+ bool load_failed() { return load_failed_; }
private:
// Set of all filters (clients) associated with this worker.
@@ -142,13 +148,12 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
base::string16 content_security_policy_;
blink::WebContentSecurityPolicyType security_policy_type_;
int worker_route_id_;
- int parent_process_id_;
int render_frame_id_;
- int64 main_resource_appcache_id_;
FilterList filters_;
scoped_refptr<WorkerDocumentSet> worker_document_set_;
ResourceContext* const resource_context_;
WorkerStoragePartition partition_;
+ bool load_failed_;
};
WorkerProcessHost(ResourceContext* resource_context,
@@ -208,6 +213,9 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
void CreateMessageFilters(int render_process_id);
void OnWorkerContextClosed(int worker_route_id);
+ void OnWorkerScriptLoaded(int worker_route_id);
+ void OnWorkerScriptLoadFailed(int worker_route_id);
+ void OnWorkerConnected(int message_port_id, int worker_route_id);
void OnAllowDatabase(int worker_route_id,
const GURL& url,
const base::string16& name,
@@ -226,8 +234,8 @@ class WorkerProcessHost : public BrowserChildProcessHostDelegate,
// Relays a message to the given endpoint. 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,
- WorkerMessageFilter* filter,
- int route_id);
+ WorkerMessageFilter* incoming_filter,
+ WorkerInstance* instance);
void ShutdownSocketStreamDispatcherHostIfNecessary();

Powered by Google App Engine
This is Rietveld 408576698