| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
| 15 #include "base/memory/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
| 20 #include "ipc/ipc_sender.h" | 20 #include "ipc/ipc_sender.h" |
| 21 #include "webkit/child/resource_loader_bridge.h" | 21 #include "webkit/child/resource_loader_bridge.h" |
| 22 #include "webkit/common/resource_type.h" |
| 22 | 23 |
| 23 struct ResourceMsg_RequestCompleteData; | 24 struct ResourceMsg_RequestCompleteData; |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class ResourceDispatcherDelegate; | 27 class ResourceDispatcherDelegate; |
| 28 struct RequestInfo; |
| 27 struct ResourceResponseHead; | 29 struct ResourceResponseHead; |
| 28 struct SiteIsolationResponseMetaData; | 30 struct SiteIsolationResponseMetaData; |
| 29 | 31 |
| 30 // This class serves as a communication interface between the | 32 // This class serves as a communication interface between the |
| 31 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in | 33 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in |
| 32 // the child process. It can be used from any child process. | 34 // the child process. It can be used from any child process. |
| 33 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { | 35 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { |
| 34 public: | 36 public: |
| 35 explicit ResourceDispatcher(IPC::Sender* sender); | 37 explicit ResourceDispatcher(IPC::Sender* sender); |
| 36 virtual ~ResourceDispatcher(); | 38 virtual ~ResourceDispatcher(); |
| 37 | 39 |
| 38 // IPC::Listener implementation. | 40 // IPC::Listener implementation. |
| 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 40 | 42 |
| 41 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so | 43 // Creates a ResourceLoaderBridge for this type of dispatcher, this is so |
| 42 // this can be tested regardless of the ResourceLoaderBridge::Create | 44 // this can be tested regardless of the ResourceLoaderBridge::Create |
| 43 // implementation. | 45 // implementation. |
| 44 webkit_glue::ResourceLoaderBridge* CreateBridge( | 46 webkit_glue::ResourceLoaderBridge* CreateBridge( |
| 45 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); | 47 const RequestInfo& request_info); |
| 46 | 48 |
| 47 // Adds a request from the pending_requests_ list, returning the new | 49 // Adds a request from the pending_requests_ list, returning the new |
| 48 // requests' ID | 50 // requests' ID |
| 49 int AddPendingRequest(webkit_glue::ResourceLoaderBridge::Peer* callback, | 51 int AddPendingRequest(webkit_glue::ResourceLoaderBridge::Peer* callback, |
| 50 ResourceType::Type resource_type, | 52 ResourceType::Type resource_type, |
| 51 int origin_pid, | 53 int origin_pid, |
| 52 const GURL& frame_origin, | 54 const GURL& frame_origin, |
| 53 const GURL& request_url); | 55 const GURL& request_url); |
| 54 | 56 |
| 55 // Removes a request from the pending_requests_ list, returning true if the | 57 // Removes a request from the pending_requests_ list, returning true if the |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 205 |
| 204 // IO thread timestamp for ongoing IPC message. | 206 // IO thread timestamp for ongoing IPC message. |
| 205 base::TimeTicks io_timestamp_; | 207 base::TimeTicks io_timestamp_; |
| 206 | 208 |
| 207 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 209 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 208 }; | 210 }; |
| 209 | 211 |
| 210 } // namespace content | 212 } // namespace content |
| 211 | 213 |
| 212 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 214 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |