Chromium Code Reviews| 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); | |
| 56 | 57 |
| 57 private: | 58 private: |
| 58 ResourceLoaderBridge::Peer* peer_; | 59 ResourceLoaderBridge::Peer* peer_; |
| 59 | 60 |
| 60 // The resource dispatcher for this loader. The bridge doesn't own it, but | 61 // The resource dispatcher for this loader. The bridge doesn't own it, but |
| 61 // it's guaranteed to outlive the bridge. | 62 // it's guaranteed to outlive the bridge. |
| 62 ResourceDispatcher* dispatcher_; | 63 ResourceDispatcher* dispatcher_; |
| 63 | 64 |
| 64 // The request to send, created on initialization for modification and | 65 // The request to send, created on initialization for modification and |
| 65 // appending data. | 66 // appending data. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 response->response_time = result.response_time; | 218 response->response_time = result.response_time; |
| 218 response->encoded_data_length = result.encoded_data_length; | 219 response->encoded_data_length = result.encoded_data_length; |
| 219 response->connection_id = result.connection_id; | 220 response->connection_id = result.connection_id; |
| 220 response->connection_reused = result.connection_reused; | 221 response->connection_reused = result.connection_reused; |
| 221 response->load_timing = result.load_timing; | 222 response->load_timing = result.load_timing; |
| 222 response->devtools_info = result.devtools_info; | 223 response->devtools_info = result.devtools_info; |
| 223 response->data.swap(result.data); | 224 response->data.swap(result.data); |
| 224 response->download_file_path = result.download_file_path; | 225 response->download_file_path = result.download_file_path; |
| 225 } | 226 } |
| 226 | 227 |
| 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, | |
|
jam
2011/08/15 16:31:02
these two values are the same, so just send one on
Dmitry Titov
2011/08/15 20:50:10
I switched to control message and pass 2 values -
jam
2011/08/15 22:07:07
what I meant is that these two values are always t
| |
| 237 request_id_)); | |
| 238 } | |
| 239 | |
| 227 } // namespace webkit_glue | 240 } // namespace webkit_glue |
| 228 | 241 |
| 229 // ResourceDispatcher --------------------------------------------------------- | 242 // ResourceDispatcher --------------------------------------------------------- |
| 230 | 243 |
| 231 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) | 244 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) |
| 232 : message_sender_(sender), | 245 : message_sender_(sender), |
| 233 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 246 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
| 234 delegate_(NULL) { | 247 delegate_(NULL) { |
| 235 } | 248 } |
| 236 | 249 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 | 597 |
| 585 // static | 598 // static |
| 586 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 599 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 587 while (!queue->empty()) { | 600 while (!queue->empty()) { |
| 588 IPC::Message* message = queue->front(); | 601 IPC::Message* message = queue->front(); |
| 589 ReleaseResourcesInDataMessage(*message); | 602 ReleaseResourcesInDataMessage(*message); |
| 590 queue->pop_front(); | 603 queue->pop_front(); |
| 591 delete message; | 604 delete message; |
| 592 } | 605 } |
| 593 } | 606 } |
| OLD | NEW |