| 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 #include "chrome/browser/worker_host/worker_process_host.h" | 5 #include "chrome/browser/worker_host/worker_process_host.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 int render_process_unique_id_; | 54 int render_process_unique_id_; |
| 55 int render_view_id_; | 55 int render_view_id_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 WorkerProcessHost::WorkerProcessHost( | 58 WorkerProcessHost::WorkerProcessHost( |
| 59 ResourceDispatcherHost* resource_dispatcher_host, | 59 ResourceDispatcherHost* resource_dispatcher_host, |
| 60 ChromeURLRequestContext *request_context) | 60 ChromeURLRequestContext *request_context) |
| 61 : ChildProcessHost(WORKER_PROCESS, resource_dispatcher_host), | 61 : BrowserChildProcessHost(WORKER_PROCESS, resource_dispatcher_host), |
| 62 request_context_(request_context), | 62 request_context_(request_context), |
| 63 appcache_dispatcher_host_( | 63 appcache_dispatcher_host_( |
| 64 new AppCacheDispatcherHost(request_context)) { | 64 new AppCacheDispatcherHost(request_context)) { |
| 65 next_route_id_callback_.reset(NewCallbackWithReturnValue( | 65 next_route_id_callback_.reset(NewCallbackWithReturnValue( |
| 66 WorkerService::GetInstance(), &WorkerService::next_worker_route_id)); | 66 WorkerService::GetInstance(), &WorkerService::next_worker_route_id)); |
| 67 db_dispatcher_host_ = new DatabaseDispatcherHost( | 67 db_dispatcher_host_ = new DatabaseDispatcherHost( |
| 68 request_context->database_tracker(), this, | 68 request_context->database_tracker(), this, |
| 69 request_context_->host_content_settings_map()); | 69 request_context_->host_content_settings_map()); |
| 70 appcache_dispatcher_host_->Initialize(this); | 70 appcache_dispatcher_host_->Initialize(this); |
| 71 } | 71 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 void WorkerProcessHost::OnProcessLaunched() { | 316 void WorkerProcessHost::OnProcessLaunched() { |
| 317 db_dispatcher_host_->Init(handle()); | 317 db_dispatcher_host_->Init(handle()); |
| 318 } | 318 } |
| 319 | 319 |
| 320 CallbackWithReturnValue<int>::Type* WorkerProcessHost::GetNextRouteIdCallback( | 320 CallbackWithReturnValue<int>::Type* WorkerProcessHost::GetNextRouteIdCallback( |
| 321 IPC::Message::Sender* sender) { | 321 IPC::Message::Sender* sender) { |
| 322 // We don't keep callbacks for senders associated with workers, so figure out | 322 // We don't keep callbacks for senders associated with workers, so figure out |
| 323 // what kind of sender this is, and cast it to the correct class to get the | 323 // what kind of sender this is, and cast it to the correct class to get the |
| 324 // callback. | 324 // callback. |
| 325 for (ChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); | 325 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); |
| 326 !iter.Done(); ++iter) { | 326 !iter.Done(); ++iter) { |
| 327 WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); | 327 WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); |
| 328 if (static_cast<IPC::Message::Sender*>(worker) == sender) | 328 if (static_cast<IPC::Message::Sender*>(worker) == sender) |
| 329 return worker->next_route_id_callback_.get(); | 329 return worker->next_route_id_callback_.get(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 // Must be a ResourceMessageFilter. | 332 // Must be a ResourceMessageFilter. |
| 333 return static_cast<ResourceMessageFilter*>(sender)->next_route_id_callback(); | 333 return static_cast<ResourceMessageFilter*>(sender)->next_route_id_callback(); |
| 334 } | 334 } |
| 335 | 335 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 return false; | 631 return false; |
| 632 } | 632 } |
| 633 | 633 |
| 634 WorkerProcessHost::WorkerInstance::SenderInfo | 634 WorkerProcessHost::WorkerInstance::SenderInfo |
| 635 WorkerProcessHost::WorkerInstance::GetSender() const { | 635 WorkerProcessHost::WorkerInstance::GetSender() const { |
| 636 DCHECK(NumSenders() == 1); | 636 DCHECK(NumSenders() == 1); |
| 637 return *senders_.begin(); | 637 return *senders_.begin(); |
| 638 } | 638 } |
| OLD | NEW |