| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 7 #ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| 8 #define CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 8 #define CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
| 15 #include "base/linked_ptr.h" | 15 #include "base/linked_ptr.h" |
| 16 #include "base/shared_memory.h" | 16 #include "base/shared_memory.h" |
| 17 #include "base/task.h" | 17 #include "base/task.h" |
| 18 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
| 19 #include "webkit/glue/resource_loader_bridge.h" | 19 #include "webkit/glue/resource_loader_bridge.h" |
| 20 | 20 |
| 21 struct ResourceResponseHead; | 21 struct ResourceResponseHead; |
| 22 | 22 |
| 23 // This class serves as a communication interface between the | 23 // This class serves as a communication interface between the |
| 24 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in | 24 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in |
| 25 // the child process. It can be used from any child process. | 25 // the child process. It can be used from any child process. |
| 26 class ResourceDispatcher { | 26 class ResourceDispatcher : public IPC::Channel::Listener { |
| 27 public: | 27 public: |
| 28 explicit ResourceDispatcher(IPC::Message::Sender* sender); | 28 explicit ResourceDispatcher(IPC::Message::Sender* sender); |
| 29 ~ResourceDispatcher(); | 29 ~ResourceDispatcher(); |
| 30 | 30 |
| 31 // Called to possibly handle the incoming IPC message. Returns true if | 31 // IPC::Channel::Listener implementation. |
| 32 // handled, else false. | |
| 33 bool OnMessageReceived(const IPC::Message& message); | 32 bool OnMessageReceived(const IPC::Message& message); |
| 34 | 33 |
| 35 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so | 34 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so |
| 36 // this can be tested regardless of the ResourceLoaderBridge::Create | 35 // this can be tested regardless of the ResourceLoaderBridge::Create |
| 37 // implementation. | 36 // implementation. |
| 38 webkit_glue::ResourceLoaderBridge* CreateBridge( | 37 webkit_glue::ResourceLoaderBridge* CreateBridge( |
| 39 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, | 38 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, |
| 40 int host_renderer_id, | 39 int host_renderer_id, |
| 41 int host_render_view_id); | 40 int host_render_view_id); |
| 42 | 41 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 143 |
| 145 // All pending requests issued to the host | 144 // All pending requests issued to the host |
| 146 PendingRequestList pending_requests_; | 145 PendingRequestList pending_requests_; |
| 147 | 146 |
| 148 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; | 147 ScopedRunnableMethodFactory<ResourceDispatcher> method_factory_; |
| 149 | 148 |
| 150 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 149 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ | 152 #endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__ |
| OLD | NEW |