| 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 "net/base/request_priority.h" | 21 #include "net/base/request_priority.h" |
| 22 #include "webkit/common/resource_type.h" | 22 #include "webkit/common/resource_type.h" |
| 23 | 23 |
| 24 struct ResourceMsg_RequestCompleteData; | 24 struct ResourceMsg_RequestCompleteData; |
| 25 | 25 |
| 26 namespace webkit_glue { | 26 namespace webkit_glue { |
| 27 class ResourceLoaderBridge; | 27 class ResourceLoaderBridge; |
| 28 struct ResourceResponseInfo; | |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace content { | 30 namespace content { |
| 32 class RequestPeer; | 31 class RequestPeer; |
| 33 class ResourceDispatcherDelegate; | 32 class ResourceDispatcherDelegate; |
| 33 struct ResourceResponseInfo; |
| 34 struct RequestInfo; | 34 struct RequestInfo; |
| 35 struct ResourceResponseHead; | 35 struct ResourceResponseHead; |
| 36 struct SiteIsolationResponseMetaData; | 36 struct SiteIsolationResponseMetaData; |
| 37 | 37 |
| 38 // This class serves as a communication interface between the | 38 // This class serves as a communication interface between the |
| 39 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in | 39 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in |
| 40 // the child process. It can be used from any child process. | 40 // the child process. It can be used from any child process. |
| 41 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { | 41 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { |
| 42 public: | 42 public: |
| 43 explicit ResourceDispatcher(IPC::Sender* sender); | 43 explicit ResourceDispatcher(IPC::Sender* sender); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 int request_id, | 159 int request_id, |
| 160 const ResourceMsg_RequestCompleteData& request_complete_data); | 160 const ResourceMsg_RequestCompleteData& request_complete_data); |
| 161 | 161 |
| 162 // Dispatch the message to one of the message response handlers. | 162 // Dispatch the message to one of the message response handlers. |
| 163 void DispatchMessage(const IPC::Message& message); | 163 void DispatchMessage(const IPC::Message& message); |
| 164 | 164 |
| 165 // Dispatch any deferred messages for the given request, provided it is not | 165 // Dispatch any deferred messages for the given request, provided it is not |
| 166 // again in the deferred state. | 166 // again in the deferred state. |
| 167 void FlushDeferredMessages(int request_id); | 167 void FlushDeferredMessages(int request_id); |
| 168 | 168 |
| 169 void ToResourceResponseInfo( | 169 void ToResourceResponseInfo(const PendingRequestInfo& request_info, |
| 170 const PendingRequestInfo& request_info, | 170 const ResourceResponseHead& browser_info, |
| 171 const ResourceResponseHead& browser_info, | 171 ResourceResponseInfo* renderer_info) const; |
| 172 webkit_glue::ResourceResponseInfo* renderer_info) const; | |
| 173 | 172 |
| 174 base::TimeTicks ToRendererCompletionTime( | 173 base::TimeTicks ToRendererCompletionTime( |
| 175 const PendingRequestInfo& request_info, | 174 const PendingRequestInfo& request_info, |
| 176 const base::TimeTicks& browser_completion_time) const; | 175 const base::TimeTicks& browser_completion_time) const; |
| 177 | 176 |
| 178 // Returns timestamp provided by IO thread. If no timestamp is supplied, | 177 // Returns timestamp provided by IO thread. If no timestamp is supplied, |
| 179 // then current time is returned. Saved timestamp is reset, so following | 178 // then current time is returned. Saved timestamp is reset, so following |
| 180 // invocations will return current time until set_io_timestamp is called. | 179 // invocations will return current time until set_io_timestamp is called. |
| 181 base::TimeTicks ConsumeIOTimestamp(); | 180 base::TimeTicks ConsumeIOTimestamp(); |
| 182 | 181 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 205 | 204 |
| 206 // IO thread timestamp for ongoing IPC message. | 205 // IO thread timestamp for ongoing IPC message. |
| 207 base::TimeTicks io_timestamp_; | 206 base::TimeTicks io_timestamp_; |
| 208 | 207 |
| 209 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 208 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
| 210 }; | 209 }; |
| 211 | 210 |
| 212 } // namespace content | 211 } // namespace content |
| 213 | 212 |
| 214 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ | 213 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ |
| OLD | NEW |