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 #include "content/common/resource_dispatcher.h" | 7 #include "content/common/resource_dispatcher.h" |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const FilePath& path, | 46 const FilePath& path, |
47 uint64 offset, | 47 uint64 offset, |
48 uint64 length, | 48 uint64 length, |
49 const base::Time& expected_modification_time); | 49 const base::Time& expected_modification_time); |
50 virtual void AppendBlobToUpload(const GURL& blob_url); | 50 virtual void AppendBlobToUpload(const GURL& blob_url); |
51 virtual void SetUploadIdentifier(int64 identifier); | 51 virtual void SetUploadIdentifier(int64 identifier); |
52 virtual bool Start(Peer* peer); | 52 virtual bool Start(Peer* peer); |
53 virtual void Cancel(); | 53 virtual void Cancel(); |
54 virtual void SetDefersLoading(bool value); | 54 virtual void SetDefersLoading(bool value); |
55 virtual void SyncLoad(SyncLoadResponse* response); | 55 virtual void SyncLoad(SyncLoadResponse* response); |
56 virtual void UpdateRoutingId(int new_routing_id); | |
57 | 56 |
58 private: | 57 private: |
59 ResourceLoaderBridge::Peer* peer_; | 58 ResourceLoaderBridge::Peer* peer_; |
60 | 59 |
61 // The resource dispatcher for this loader. The bridge doesn't own it, but | 60 // The resource dispatcher for this loader. The bridge doesn't own it, but |
62 // it's guaranteed to outlive the bridge. | 61 // it's guaranteed to outlive the bridge. |
63 ResourceDispatcher* dispatcher_; | 62 ResourceDispatcher* dispatcher_; |
64 | 63 |
65 // The request to send, created on initialization for modification and | 64 // The request to send, created on initialization for modification and |
66 // appending data. | 65 // appending data. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 response->response_time = result.response_time; | 217 response->response_time = result.response_time; |
219 response->encoded_data_length = result.encoded_data_length; | 218 response->encoded_data_length = result.encoded_data_length; |
220 response->connection_id = result.connection_id; | 219 response->connection_id = result.connection_id; |
221 response->connection_reused = result.connection_reused; | 220 response->connection_reused = result.connection_reused; |
222 response->load_timing = result.load_timing; | 221 response->load_timing = result.load_timing; |
223 response->devtools_info = result.devtools_info; | 222 response->devtools_info = result.devtools_info; |
224 response->data.swap(result.data); | 223 response->data.swap(result.data); |
225 response->download_file_path = result.download_file_path; | 224 response->download_file_path = result.download_file_path; |
226 } | 225 } |
227 | 226 |
228 void IPCResourceLoaderBridge::UpdateRoutingId(int new_routing_id) { | |
229 if (request_id_ < 0) { | |
230 NOTREACHED() << "Trying to update an unstarted request"; | |
231 return; | |
232 } | |
233 | |
234 routing_id_ = new_routing_id; | |
235 dispatcher_->message_sender()->Send( | |
236 new ResourceHostMsg_TransferRequestToNewPage(new_routing_id, | |
237 request_id_)); | |
238 } | |
239 | |
240 } // namespace webkit_glue | 227 } // namespace webkit_glue |
241 | 228 |
242 // ResourceDispatcher --------------------------------------------------------- | 229 // ResourceDispatcher --------------------------------------------------------- |
243 | 230 |
244 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) | 231 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) |
245 : message_sender_(sender), | 232 : message_sender_(sender), |
246 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 233 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
247 delegate_(NULL) { | 234 delegate_(NULL) { |
248 } | 235 } |
249 | 236 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 | 584 |
598 // static | 585 // static |
599 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 586 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
600 while (!queue->empty()) { | 587 while (!queue->empty()) { |
601 IPC::Message* message = queue->front(); | 588 IPC::Message* message = queue->front(); |
602 ReleaseResourcesInDataMessage(*message); | 589 ReleaseResourcesInDataMessage(*message); |
603 queue->pop_front(); | 590 queue->pop_front(); |
604 delete message; | 591 delete message; |
605 } | 592 } |
606 } | 593 } |
OLD | NEW |