OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/resource_dispatcher.h" | 7 #include "chrome/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 int host_render_view_id); | 53 int host_render_view_id); |
54 virtual ~IPCResourceLoaderBridge(); | 54 virtual ~IPCResourceLoaderBridge(); |
55 | 55 |
56 // ResourceLoaderBridge | 56 // ResourceLoaderBridge |
57 virtual void AppendDataToUpload(const char* data, int data_len); | 57 virtual void AppendDataToUpload(const char* data, int data_len); |
58 virtual void AppendFileRangeToUpload( | 58 virtual void AppendFileRangeToUpload( |
59 const FilePath& path, | 59 const FilePath& path, |
60 uint64 offset, | 60 uint64 offset, |
61 uint64 length, | 61 uint64 length, |
62 const base::Time& expected_modification_time); | 62 const base::Time& expected_modification_time); |
| 63 virtual void AppendBlobToUpload(const GURL& blob_url); |
63 virtual void SetUploadIdentifier(int64 identifier); | 64 virtual void SetUploadIdentifier(int64 identifier); |
64 virtual bool Start(Peer* peer); | 65 virtual bool Start(Peer* peer); |
65 virtual void Cancel(); | 66 virtual void Cancel(); |
66 virtual void SetDefersLoading(bool value); | 67 virtual void SetDefersLoading(bool value); |
67 virtual void SyncLoad(SyncLoadResponse* response); | 68 virtual void SyncLoad(SyncLoadResponse* response); |
68 | 69 |
69 #ifdef LOG_RESOURCE_REQUESTS | 70 #ifdef LOG_RESOURCE_REQUESTS |
70 const std::string& url() const { return url_; } | 71 const std::string& url() const { return url_; } |
71 #endif | 72 #endif |
72 | 73 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 const FilePath& path, uint64 offset, uint64 length, | 163 const FilePath& path, uint64 offset, uint64 length, |
163 const base::Time& expected_modification_time) { | 164 const base::Time& expected_modification_time) { |
164 DCHECK(request_id_ == -1) << "request already started"; | 165 DCHECK(request_id_ == -1) << "request already started"; |
165 | 166 |
166 if (!request_.upload_data) | 167 if (!request_.upload_data) |
167 request_.upload_data = new net::UploadData(); | 168 request_.upload_data = new net::UploadData(); |
168 request_.upload_data->AppendFileRange(path, offset, length, | 169 request_.upload_data->AppendFileRange(path, offset, length, |
169 expected_modification_time); | 170 expected_modification_time); |
170 } | 171 } |
171 | 172 |
| 173 void IPCResourceLoaderBridge::AppendBlobToUpload(const GURL& blob_url) { |
| 174 DCHECK(request_id_ == -1) << "request already started"; |
| 175 |
| 176 if (!request_.upload_data) |
| 177 request_.upload_data = new net::UploadData(); |
| 178 request_.upload_data->AppendBlob(blob_url); |
| 179 } |
| 180 |
172 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { | 181 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { |
173 DCHECK(request_id_ == -1) << "request already started"; | 182 DCHECK(request_id_ == -1) << "request already started"; |
174 | 183 |
175 if (!request_.upload_data) | 184 if (!request_.upload_data) |
176 request_.upload_data = new net::UploadData(); | 185 request_.upload_data = new net::UploadData(); |
177 request_.upload_data->set_identifier(identifier); | 186 request_.upload_data->set_identifier(identifier); |
178 } | 187 } |
179 | 188 |
180 // Writes a footer on the message and sends it | 189 // Writes a footer on the message and sends it |
181 bool IPCResourceLoaderBridge::Start(Peer* peer) { | 190 bool IPCResourceLoaderBridge::Start(Peer* peer) { |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 | 632 |
624 // static | 633 // static |
625 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 634 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
626 while (!queue->empty()) { | 635 while (!queue->empty()) { |
627 IPC::Message* message = queue->front(); | 636 IPC::Message* message = queue->front(); |
628 ReleaseResourcesInDataMessage(*message); | 637 ReleaseResourcesInDataMessage(*message); |
629 queue->pop_front(); | 638 queue->pop_front(); |
630 delete message; | 639 delete message; |
631 } | 640 } |
632 } | 641 } |
OLD | NEW |