class IndexedDBContextImpl;
class ResourceContext;
class SocketStreamDispatcherHost;
+class WorkerMessageFilter;
class WorkerServiceImpl;
// The WorkerProcessHost is the interface that represents the browser side of
const base::string16& content_security_policy,
blink::WebContentSecurityPolicyType security_policy_type,
int worker_route_id,
- int parent_process_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,
+ int render_frame_id,
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);
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;
return security_policy_type_;
}
int worker_route_id() const { return worker_route_id_; }
- int parent_process_id() const { return parent_process_id_; }
- int64 main_resource_appcache_id() const {
- return main_resource_appcache_id_;
- }
+ int render_frame_id() const { return render_frame_id_; }
WorkerDocumentSet* worker_document_set() const {
return worker_document_set_.get();
}
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.
base::string16 content_security_policy_;
blink::WebContentSecurityPolicyType security_policy_type_;
int worker_route_id_;
- int parent_process_id_;
- int64 main_resource_appcache_id_;
+ int render_frame_id_;
FilterList filters_;
scoped_refptr<WorkerDocumentSet> worker_document_set_;
ResourceContext* const resource_context_;
WorkerStoragePartition partition_;
+ bool load_failed_;
};
WorkerProcessHost(ResourceContext* resource_context,
virtual bool Send(IPC::Message* message) OVERRIDE;
// Starts the process. Returns true iff it succeeded.
- // |render_process_id| is the renderer process responsible for starting this
- // worker.
- bool Init(int render_process_id);
+ // |render_process_id| and |render_frame_id| are the renderer process and the
+ // renderer frame responsible for starting this worker.
+ bool Init(int render_process_id, int render_frame_id);
// Creates a worker object in the process.
void CreateWorker(const WorkerInstance& instance);
void CreateMessageFilters(int render_process_id);
void OnWorkerContextClosed(int worker_route_id);
+ void OnWorkerContextDestroyed(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,
// 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();