| 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> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 14 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 15 #include "chrome/browser/browser_child_process_host.h" | 16 #include "chrome/browser/browser_child_process_host.h" |
| 17 #include "chrome/browser/browser_io_message_filter.h" |
| 16 #include "chrome/browser/net/chrome_url_request_context.h" | 18 #include "chrome/browser/net/chrome_url_request_context.h" |
| 17 #include "chrome/browser/worker_host/worker_document_set.h" | 19 #include "chrome/browser/worker_host/worker_document_set.h" |
| 18 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 19 #include "ipc/ipc_channel.h" | 21 #include "ipc/ipc_channel.h" |
| 20 | 22 |
| 21 class AppCacheDispatcherHost; | |
| 22 class BlobDispatcherHost; | 23 class BlobDispatcherHost; |
| 23 class ChromeURLRequestContext; | 24 class ChromeURLRequestContext; |
| 24 class ChromeURLRequestContextGetter; | 25 class ChromeURLRequestContextGetter; |
| 25 class DatabaseDispatcherHost; | 26 class DatabaseDispatcherHost; |
| 26 class FileSystemDispatcherHost; | 27 class FileSystemDispatcherHost; |
| 27 class FileUtilitiesDispatcherHost; | 28 class FileUtilitiesDispatcherHost; |
| 28 class MimeRegistryDispatcher; | 29 class MimeRegistryDispatcher; |
| 29 namespace webkit_database { | 30 namespace webkit_database { |
| 30 class DatabaseTracker; | 31 class DatabaseTracker; |
| 31 } // namespace webkit_database | 32 } // namespace webkit_database |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 typedef std::list<WorkerInstance> Instances; | 153 typedef std::list<WorkerInstance> Instances; |
| 153 const Instances& instances() const { return instances_; } | 154 const Instances& instances() const { return instances_; } |
| 154 Instances& mutable_instances() { return instances_; } | 155 Instances& mutable_instances() { return instances_; } |
| 155 | 156 |
| 156 private: | 157 private: |
| 157 // ResourceDispatcherHost::Receiver implementation: | 158 // ResourceDispatcherHost::Receiver implementation: |
| 158 virtual URLRequestContext* GetRequestContext( | 159 virtual URLRequestContext* GetRequestContext( |
| 159 uint32 request_id, | 160 uint32 request_id, |
| 160 const ViewHostMsg_Resource_Request& request_data); | 161 const ViewHostMsg_Resource_Request& request_data); |
| 161 | 162 |
| 163 // IPC::Channel::Listener implementation: |
| 162 // Called when a message arrives from the worker process. | 164 // Called when a message arrives from the worker process. |
| 163 virtual void OnMessageReceived(const IPC::Message& message); | 165 virtual void OnMessageReceived(const IPC::Message& message); |
| 166 virtual void OnChannelConnected(int32 peer_pid); |
| 167 virtual void OnChannelError(); |
| 168 |
| 169 // Creates and adds the message filters. |
| 170 void CreateMessageFilters(); |
| 164 | 171 |
| 165 // Called when the process has been launched successfully. | 172 // Called when the process has been launched successfully. |
| 166 virtual void OnProcessLaunched(); | 173 virtual void OnProcessLaunched(); |
| 167 | 174 |
| 168 // Called when the app invokes close() from within worker context. | 175 // Called when the app invokes close() from within worker context. |
| 169 void OnWorkerContextClosed(int worker_route_id); | 176 void OnWorkerContextClosed(int worker_route_id); |
| 170 | 177 |
| 171 // Called if a worker tries to connect to a shared worker. | 178 // Called if a worker tries to connect to a shared worker. |
| 172 void OnLookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, | 179 void OnLookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, |
| 173 bool* exists, | 180 bool* exists, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 200 // worker. | 207 // worker. |
| 201 void OnAllowDatabase(const GURL& url, | 208 void OnAllowDatabase(const GURL& url, |
| 202 const string16& name, | 209 const string16& name, |
| 203 const string16& display_name, | 210 const string16& display_name, |
| 204 unsigned long estimated_size, | 211 unsigned long estimated_size, |
| 205 IPC::Message* reply_msg); | 212 IPC::Message* reply_msg); |
| 206 | 213 |
| 207 Instances instances_; | 214 Instances instances_; |
| 208 | 215 |
| 209 scoped_refptr<ChromeURLRequestContext> request_context_; | 216 scoped_refptr<ChromeURLRequestContext> request_context_; |
| 210 scoped_ptr<AppCacheDispatcherHost> appcache_dispatcher_host_; | |
| 211 scoped_refptr<DatabaseDispatcherHost> db_dispatcher_host_; | 217 scoped_refptr<DatabaseDispatcherHost> db_dispatcher_host_; |
| 212 scoped_ptr<BlobDispatcherHost> blob_dispatcher_host_; | 218 scoped_ptr<BlobDispatcherHost> blob_dispatcher_host_; |
| 213 scoped_refptr<FileSystemDispatcherHost> file_system_dispatcher_host_; | 219 scoped_refptr<FileSystemDispatcherHost> file_system_dispatcher_host_; |
| 214 scoped_refptr<FileUtilitiesDispatcherHost> file_utilities_dispatcher_host_; | 220 scoped_refptr<FileUtilitiesDispatcherHost> file_utilities_dispatcher_host_; |
| 215 scoped_refptr<MimeRegistryDispatcher> mime_registry_dispatcher_; | 221 scoped_refptr<MimeRegistryDispatcher> mime_registry_dispatcher_; |
| 216 | 222 |
| 223 // Holds all the IPC message filters. Since the worker process host is on the |
| 224 // IO thread, we don't have a IPC::ChannelProxy and so we manage filters |
| 225 // manually. |
| 226 std::vector<scoped_refptr<BrowserIOMessageFilter> > filters_; |
| 227 |
| 217 // A callback to create a routing id for the associated worker process. | 228 // A callback to create a routing id for the associated worker process. |
| 218 scoped_ptr<CallbackWithReturnValue<int>::Type> next_route_id_callback_; | 229 scoped_ptr<CallbackWithReturnValue<int>::Type> next_route_id_callback_; |
| 219 | 230 |
| 220 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); | 231 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); |
| 221 }; | 232 }; |
| 222 | 233 |
| 223 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 234 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| OLD | NEW |