OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // net::URLRequestContext) that a WorkerProcessHost serves a single | 29 // net::URLRequestContext) that a WorkerProcessHost serves a single |
30 // BrowserContext. | 30 // BrowserContext. |
31 class WorkerProcessHost : public BrowserChildProcessHost { | 31 class WorkerProcessHost : public BrowserChildProcessHost { |
32 public: | 32 public: |
33 | 33 |
34 // Contains information about each worker instance, needed to forward messages | 34 // Contains information about each worker instance, needed to forward messages |
35 // between the renderer and worker processes. | 35 // between the renderer and worker processes. |
36 class WorkerInstance { | 36 class WorkerInstance { |
37 public: | 37 public: |
38 WorkerInstance(const GURL& url, | 38 WorkerInstance(const GURL& url, |
39 bool shared, | |
40 const string16& name, | 39 const string16& name, |
41 int worker_route_id, | 40 int worker_route_id, |
42 int parent_process_id, | 41 int parent_process_id, |
43 int parent_appcache_host_id, | |
44 int64 main_resource_appcache_id, | 42 int64 main_resource_appcache_id, |
45 const content::ResourceContext* resource_context); | 43 const content::ResourceContext* resource_context); |
46 // Used for pending instances. Rest of the parameters are ignored. | 44 // Used for pending instances. Rest of the parameters are ignored. |
47 WorkerInstance(const GURL& url, | 45 WorkerInstance(const GURL& url, |
48 bool shared, | 46 bool shared, |
49 const string16& name, | 47 const string16& name, |
50 const content::ResourceContext* resource_context); | 48 const content::ResourceContext* resource_context); |
51 ~WorkerInstance(); | 49 ~WorkerInstance(); |
52 | 50 |
53 // Unique identifier for a worker client. | 51 // Unique identifier for a worker client. |
(...skipping 21 matching lines...) Expand all Loading... |
75 const content::ResourceContext* resource_context) const; | 73 const content::ResourceContext* resource_context) const; |
76 | 74 |
77 // Shares the passed instance's WorkerDocumentSet with this instance. This | 75 // Shares the passed instance's WorkerDocumentSet with this instance. This |
78 // instance's current WorkerDocumentSet is dereferenced (and freed if this | 76 // instance's current WorkerDocumentSet is dereferenced (and freed if this |
79 // is the only reference) as a result. | 77 // is the only reference) as a result. |
80 void ShareDocumentSet(const WorkerInstance& instance) { | 78 void ShareDocumentSet(const WorkerInstance& instance) { |
81 worker_document_set_ = instance.worker_document_set_; | 79 worker_document_set_ = instance.worker_document_set_; |
82 }; | 80 }; |
83 | 81 |
84 // Accessors | 82 // Accessors |
85 bool shared() const { return shared_; } | |
86 bool closed() const { return closed_; } | 83 bool closed() const { return closed_; } |
87 void set_closed(bool closed) { closed_ = closed; } | 84 void set_closed(bool closed) { closed_ = closed; } |
88 const GURL& url() const { return url_; } | 85 const GURL& url() const { return url_; } |
89 const string16 name() const { return name_; } | 86 const string16 name() const { return name_; } |
90 int worker_route_id() const { return worker_route_id_; } | 87 int worker_route_id() const { return worker_route_id_; } |
91 int parent_process_id() const { return parent_process_id_; } | 88 int parent_process_id() const { return parent_process_id_; } |
92 int parent_appcache_host_id() const { return parent_appcache_host_id_; } | |
93 int64 main_resource_appcache_id() const { | 89 int64 main_resource_appcache_id() const { |
94 return main_resource_appcache_id_; | 90 return main_resource_appcache_id_; |
95 } | 91 } |
96 WorkerDocumentSet* worker_document_set() const { | 92 WorkerDocumentSet* worker_document_set() const { |
97 return worker_document_set_; | 93 return worker_document_set_; |
98 } | 94 } |
99 const content::ResourceContext* resource_context() const { | 95 const content::ResourceContext* resource_context() const { |
100 return resource_context_; | 96 return resource_context_; |
101 } | 97 } |
102 | 98 |
103 private: | 99 private: |
104 // Set of all filters (clients) associated with this worker. | 100 // Set of all filters (clients) associated with this worker. |
105 GURL url_; | 101 GURL url_; |
106 bool shared_; | |
107 bool closed_; | 102 bool closed_; |
108 string16 name_; | 103 string16 name_; |
109 int worker_route_id_; | 104 int worker_route_id_; |
110 int parent_process_id_; | 105 int parent_process_id_; |
111 int parent_appcache_host_id_; | |
112 int64 main_resource_appcache_id_; | 106 int64 main_resource_appcache_id_; |
113 FilterList filters_; | 107 FilterList filters_; |
114 scoped_refptr<WorkerDocumentSet> worker_document_set_; | 108 scoped_refptr<WorkerDocumentSet> worker_document_set_; |
115 const content::ResourceContext* const resource_context_; | 109 const content::ResourceContext* const resource_context_; |
116 }; | 110 }; |
117 | 111 |
118 WorkerProcessHost( | 112 WorkerProcessHost( |
119 const content::ResourceContext* resource_context, | 113 const content::ResourceContext* resource_context, |
120 ResourceDispatcherHost* resource_dispatcher_host); | 114 ResourceDispatcherHost* resource_dispatcher_host); |
121 virtual ~WorkerProcessHost(); | 115 virtual ~WorkerProcessHost(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // keep this around since we'll use it when forward messages to the worker | 186 // keep this around since we'll use it when forward messages to the worker |
193 // process. | 187 // process. |
194 scoped_refptr<WorkerMessageFilter> worker_message_filter_; | 188 scoped_refptr<WorkerMessageFilter> worker_message_filter_; |
195 | 189 |
196 ResourceDispatcherHost* const resource_dispatcher_host_; | 190 ResourceDispatcherHost* const resource_dispatcher_host_; |
197 | 191 |
198 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); | 192 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); |
199 }; | 193 }; |
200 | 194 |
201 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 195 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
OLD | NEW |