| 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 #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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const FilePath& path, | 55 const FilePath& path, |
| 56 uint64 offset, | 56 uint64 offset, |
| 57 uint64 length, | 57 uint64 length, |
| 58 const base::Time& expected_modification_time); | 58 const base::Time& expected_modification_time); |
| 59 virtual void AppendBlobToUpload(const GURL& blob_url); | 59 virtual void AppendBlobToUpload(const GURL& blob_url); |
| 60 virtual void SetUploadIdentifier(int64 identifier); | 60 virtual void SetUploadIdentifier(int64 identifier); |
| 61 virtual bool Start(Peer* peer); | 61 virtual bool Start(Peer* peer); |
| 62 virtual void Cancel(); | 62 virtual void Cancel(); |
| 63 virtual void SetDefersLoading(bool value); | 63 virtual void SetDefersLoading(bool value); |
| 64 virtual void SyncLoad(SyncLoadResponse* response); | 64 virtual void SyncLoad(SyncLoadResponse* response); |
| 65 virtual void UpdateRoutingId(int new_routing_id); | |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 ResourceLoaderBridge::Peer* peer_; | 67 ResourceLoaderBridge::Peer* peer_; |
| 69 | 68 |
| 70 // The resource dispatcher for this loader. The bridge doesn't own it, but | 69 // The resource dispatcher for this loader. The bridge doesn't own it, but |
| 71 // it's guaranteed to outlive the bridge. | 70 // it's guaranteed to outlive the bridge. |
| 72 ResourceDispatcher* dispatcher_; | 71 ResourceDispatcher* dispatcher_; |
| 73 | 72 |
| 74 // The request to send, created on initialization for modification and | 73 // The request to send, created on initialization for modification and |
| 75 // appending data. | 74 // appending data. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 response->response_time = result.response_time; | 253 response->response_time = result.response_time; |
| 255 response->encoded_data_length = result.encoded_data_length; | 254 response->encoded_data_length = result.encoded_data_length; |
| 256 response->connection_id = result.connection_id; | 255 response->connection_id = result.connection_id; |
| 257 response->connection_reused = result.connection_reused; | 256 response->connection_reused = result.connection_reused; |
| 258 response->load_timing = result.load_timing; | 257 response->load_timing = result.load_timing; |
| 259 response->devtools_info = result.devtools_info; | 258 response->devtools_info = result.devtools_info; |
| 260 response->data.swap(result.data); | 259 response->data.swap(result.data); |
| 261 response->download_file_path = result.download_file_path; | 260 response->download_file_path = result.download_file_path; |
| 262 } | 261 } |
| 263 | 262 |
| 264 void IPCResourceLoaderBridge::UpdateRoutingId(int new_routing_id) { | |
| 265 if (request_id_ < 0) { | |
| 266 NOTREACHED() << "Trying to update an unstarted request"; | |
| 267 return; | |
| 268 } | |
| 269 | |
| 270 routing_id_ = new_routing_id; | |
| 271 dispatcher_->message_sender()->Send( | |
| 272 new ResourceHostMsg_TransferRequestToNewPage(new_routing_id, | |
| 273 request_id_)); | |
| 274 } | |
| 275 | |
| 276 } // namespace webkit_glue | 263 } // namespace webkit_glue |
| 277 | 264 |
| 278 // ResourceDispatcher --------------------------------------------------------- | 265 // ResourceDispatcher --------------------------------------------------------- |
| 279 | 266 |
| 280 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) | 267 ResourceDispatcher::ResourceDispatcher(IPC::Message::Sender* sender) |
| 281 : message_sender_(sender), | 268 : message_sender_(sender), |
| 282 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 269 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 283 delegate_(NULL) { | 270 delegate_(NULL) { |
| 284 } | 271 } |
| 285 | 272 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 687 |
| 701 // static | 688 // static |
| 702 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 689 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
| 703 while (!queue->empty()) { | 690 while (!queue->empty()) { |
| 704 IPC::Message* message = queue->front(); | 691 IPC::Message* message = queue->front(); |
| 705 ReleaseResourcesInDataMessage(*message); | 692 ReleaseResourcesInDataMessage(*message); |
| 706 queue->pop_front(); | 693 queue->pop_front(); |
| 707 delete message; | 694 delete message; |
| 708 } | 695 } |
| 709 } | 696 } |
| OLD | NEW |