| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <vector> | |
| 11 | 10 |
| 12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 12 #include "base/callback.h" |
| 14 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 15 #include "chrome/browser/browser_child_process_host.h" | 14 #include "chrome/browser/browser_child_process_host.h" |
| 16 #include "chrome/browser/browser_message_filter.h" | |
| 17 #include "chrome/browser/net/chrome_url_request_context.h" | 15 #include "chrome/browser/net/chrome_url_request_context.h" |
| 18 #include "chrome/browser/worker_host/worker_document_set.h" | 16 #include "chrome/browser/worker_host/worker_document_set.h" |
| 19 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 20 | 18 |
| 21 class ChromeURLRequestContext; | 19 class ChromeURLRequestContext; |
| 22 class ChromeURLRequestContextGetter; | 20 class ChromeURLRequestContextGetter; |
| 23 namespace webkit_database { | 21 namespace webkit_database { |
| 24 class DatabaseTracker; | 22 class DatabaseTracker; |
| 25 } // namespace webkit_database | 23 } // namespace webkit_database |
| 26 | 24 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 139 } |
| 142 | 140 |
| 143 protected: | 141 protected: |
| 144 friend class WorkerService; | 142 friend class WorkerService; |
| 145 | 143 |
| 146 typedef std::list<WorkerInstance> Instances; | 144 typedef std::list<WorkerInstance> Instances; |
| 147 const Instances& instances() const { return instances_; } | 145 const Instances& instances() const { return instances_; } |
| 148 Instances& mutable_instances() { return instances_; } | 146 Instances& mutable_instances() { return instances_; } |
| 149 | 147 |
| 150 private: | 148 private: |
| 151 // ResourceDispatcherHost::Receiver implementation: | |
| 152 virtual URLRequestContext* GetRequestContext( | |
| 153 uint32 request_id, | |
| 154 const ViewHostMsg_Resource_Request& request_data); | |
| 155 | |
| 156 // IPC::Channel::Listener implementation: | 149 // IPC::Channel::Listener implementation: |
| 157 // Called when a message arrives from the worker process. | 150 // Called when a message arrives from the worker process. |
| 158 virtual void OnMessageReceived(const IPC::Message& message); | 151 virtual void OnMessageReceived(const IPC::Message& message); |
| 159 virtual void OnChannelConnected(int32 peer_pid); | |
| 160 virtual void OnChannelError(); | |
| 161 | 152 |
| 162 // Creates and adds the message filters. | 153 // Creates and adds the message filters. |
| 163 void CreateMessageFilters(); | 154 void CreateMessageFilters(); |
| 164 | 155 |
| 165 // Called when the process has been launched successfully. | 156 // Called when the process has been launched successfully. |
| 166 virtual void OnProcessLaunched(); | 157 virtual void OnProcessLaunched(); |
| 167 | 158 |
| 168 // Called when the app invokes close() from within worker context. | 159 // Called when the app invokes close() from within worker context. |
| 169 void OnWorkerContextClosed(int worker_route_id); | 160 void OnWorkerContextClosed(int worker_route_id); |
| 170 | 161 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 201 void OnAllowDatabase(const GURL& url, | 192 void OnAllowDatabase(const GURL& url, |
| 202 const string16& name, | 193 const string16& name, |
| 203 const string16& display_name, | 194 const string16& display_name, |
| 204 unsigned long estimated_size, | 195 unsigned long estimated_size, |
| 205 IPC::Message* reply_msg); | 196 IPC::Message* reply_msg); |
| 206 | 197 |
| 207 Instances instances_; | 198 Instances instances_; |
| 208 | 199 |
| 209 scoped_refptr<ChromeURLRequestContext> request_context_; | 200 scoped_refptr<ChromeURLRequestContext> request_context_; |
| 210 | 201 |
| 211 // Holds all the IPC message filters. Since the worker process host is on the | |
| 212 // IO thread, we don't have a IPC::ChannelProxy and so we manage filters | |
| 213 // manually. | |
| 214 std::vector<scoped_refptr<BrowserMessageFilter> > filters_; | |
| 215 | |
| 216 // A callback to create a routing id for the associated worker process. | 202 // A callback to create a routing id for the associated worker process. |
| 217 scoped_ptr<CallbackWithReturnValue<int>::Type> next_route_id_callback_; | 203 scoped_ptr<CallbackWithReturnValue<int>::Type> next_route_id_callback_; |
| 218 | 204 |
| 219 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); | 205 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); |
| 220 }; | 206 }; |
| 221 | 207 |
| 222 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 208 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| OLD | NEW |