OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_RESOURCE_DISPATCHER_H_ | 7 #ifndef CONTENT_COMMON_RESOURCE_DISPATCHER_H_ |
8 #define CONTENT_COMMON_RESOURCE_DISPATCHER_H_ | 8 #define CONTENT_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/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/shared_memory.h" | 17 #include "base/shared_memory.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "ipc/ipc_channel.h" | 19 #include "ipc/ipc_channel.h" |
20 #include "webkit/glue/resource_loader_bridge.h" | 20 #include "webkit/glue/resource_loader_bridge.h" |
21 | 21 |
22 struct ResourceResponseHead; | |
23 | |
24 namespace content { | 22 namespace content { |
25 class ResourceDispatcherDelegate; | 23 class ResourceDispatcherDelegate; |
| 24 struct ResourceResponseHead; |
26 } | 25 } |
27 | 26 |
28 // This class serves as a communication interface between the | 27 // This class serves as a communication interface between the |
29 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in | 28 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in |
30 // the child process. It can be used from any child process. | 29 // the child process. It can be used from any child process. |
31 class CONTENT_EXPORT ResourceDispatcher : public IPC::Channel::Listener { | 30 class CONTENT_EXPORT ResourceDispatcher : public IPC::Channel::Listener { |
32 public: | 31 public: |
33 explicit ResourceDispatcher(IPC::Message::Sender* sender); | 32 explicit ResourceDispatcher(IPC::Message::Sender* sender); |
34 virtual ~ResourceDispatcher(); | 33 virtual ~ResourceDispatcher(); |
35 | 34 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 97 |
99 // Follows redirect, if any, for the given request. | 98 // Follows redirect, if any, for the given request. |
100 void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info); | 99 void FollowPendingRedirect(int request_id, PendingRequestInfo& request_info); |
101 | 100 |
102 // Message response handlers, called by the message handler for this process. | 101 // Message response handlers, called by the message handler for this process. |
103 void OnUploadProgress( | 102 void OnUploadProgress( |
104 const IPC::Message& message, | 103 const IPC::Message& message, |
105 int request_id, | 104 int request_id, |
106 int64 position, | 105 int64 position, |
107 int64 size); | 106 int64 size); |
108 void OnReceivedResponse(int request_id, const ResourceResponseHead&); | 107 void OnReceivedResponse(int request_id, const content::ResourceResponseHead&); |
109 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); | 108 void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data); |
110 void OnReceivedRedirect( | 109 void OnReceivedRedirect( |
111 const IPC::Message& message, | 110 const IPC::Message& message, |
112 int request_id, | 111 int request_id, |
113 const GURL& new_url, | 112 const GURL& new_url, |
114 const webkit_glue::ResourceResponseInfo& info); | 113 const webkit_glue::ResourceResponseInfo& info); |
115 void OnReceivedData( | 114 void OnReceivedData( |
116 const IPC::Message& message, | 115 const IPC::Message& message, |
117 int request_id, | 116 int request_id, |
118 base::SharedMemoryHandle data, | 117 base::SharedMemoryHandle data, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 PendingRequestList pending_requests_; | 154 PendingRequestList pending_requests_; |
156 | 155 |
157 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; | 156 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; |
158 | 157 |
159 content::ResourceDispatcherDelegate* delegate_; | 158 content::ResourceDispatcherDelegate* delegate_; |
160 | 159 |
161 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); | 160 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); |
162 }; | 161 }; |
163 | 162 |
164 #endif // CONTENT_COMMON_RESOURCE_DISPATCHER_H_ | 163 #endif // CONTENT_COMMON_RESOURCE_DISPATCHER_H_ |
OLD | NEW |