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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const ResourceLoaderBridge::RequestInfo& request_info); | 46 const ResourceLoaderBridge::RequestInfo& request_info); |
47 virtual ~IPCResourceLoaderBridge(); | 47 virtual ~IPCResourceLoaderBridge(); |
48 | 48 |
49 // ResourceLoaderBridge | 49 // ResourceLoaderBridge |
50 virtual void AppendDataToUpload(const char* data, int data_len); | 50 virtual void AppendDataToUpload(const char* data, int data_len); |
51 virtual void AppendFileRangeToUpload( | 51 virtual void AppendFileRangeToUpload( |
52 const FilePath& path, | 52 const FilePath& path, |
53 uint64 offset, | 53 uint64 offset, |
54 uint64 length, | 54 uint64 length, |
55 const base::Time& expected_modification_time); | 55 const base::Time& expected_modification_time); |
| 56 virtual void AppendFileSystemFileRangeToUpload( |
| 57 const GURL& url, |
| 58 uint64 offset, |
| 59 uint64 length, |
| 60 const base::Time& expected_modification_time); |
56 virtual void AppendBlobToUpload(const GURL& blob_url); | 61 virtual void AppendBlobToUpload(const GURL& blob_url); |
57 virtual void SetUploadIdentifier(int64 identifier); | 62 virtual void SetUploadIdentifier(int64 identifier); |
58 virtual bool Start(Peer* peer); | 63 virtual bool Start(Peer* peer); |
59 virtual void Cancel(); | 64 virtual void Cancel(); |
60 virtual void SetDefersLoading(bool value); | 65 virtual void SetDefersLoading(bool value); |
61 virtual void SyncLoad(SyncLoadResponse* response); | 66 virtual void SyncLoad(SyncLoadResponse* response); |
62 | 67 |
63 private: | 68 private: |
64 ResourceLoaderBridge::Peer* peer_; | 69 ResourceLoaderBridge::Peer* peer_; |
65 | 70 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const FilePath& path, uint64 offset, uint64 length, | 164 const FilePath& path, uint64 offset, uint64 length, |
160 const base::Time& expected_modification_time) { | 165 const base::Time& expected_modification_time) { |
161 DCHECK(request_id_ == -1) << "request already started"; | 166 DCHECK(request_id_ == -1) << "request already started"; |
162 | 167 |
163 if (!request_.upload_data) | 168 if (!request_.upload_data) |
164 request_.upload_data = new net::UploadData(); | 169 request_.upload_data = new net::UploadData(); |
165 request_.upload_data->AppendFileRange(path, offset, length, | 170 request_.upload_data->AppendFileRange(path, offset, length, |
166 expected_modification_time); | 171 expected_modification_time); |
167 } | 172 } |
168 | 173 |
| 174 void IPCResourceLoaderBridge::AppendFileSystemFileRangeToUpload( |
| 175 const GURL& url, uint64 offset, uint64 length, |
| 176 const base::Time& expected_modification_time) { |
| 177 DCHECK(request_id_ == -1) << "request already started"; |
| 178 |
| 179 if (!request_.upload_data) |
| 180 request_.upload_data = new net::UploadData(); |
| 181 request_.upload_data->AppendFileSystemFileRange( |
| 182 url, offset, length, expected_modification_time); |
| 183 } |
| 184 |
169 void IPCResourceLoaderBridge::AppendBlobToUpload(const GURL& blob_url) { | 185 void IPCResourceLoaderBridge::AppendBlobToUpload(const GURL& blob_url) { |
170 DCHECK(request_id_ == -1) << "request already started"; | 186 DCHECK(request_id_ == -1) << "request already started"; |
171 | 187 |
172 if (!request_.upload_data) | 188 if (!request_.upload_data) |
173 request_.upload_data = new net::UploadData(); | 189 request_.upload_data = new net::UploadData(); |
174 request_.upload_data->AppendBlob(blob_url); | 190 request_.upload_data->AppendBlob(blob_url); |
175 } | 191 } |
176 | 192 |
177 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { | 193 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { |
178 DCHECK(request_id_ == -1) << "request already started"; | 194 DCHECK(request_id_ == -1) << "request already started"; |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { | 701 void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) { |
686 while (!queue->empty()) { | 702 while (!queue->empty()) { |
687 IPC::Message* message = queue->front(); | 703 IPC::Message* message = queue->front(); |
688 ReleaseResourcesInDataMessage(*message); | 704 ReleaseResourcesInDataMessage(*message); |
689 queue->pop_front(); | 705 queue->pop_front(); |
690 delete message; | 706 delete message; |
691 } | 707 } |
692 } | 708 } |
693 | 709 |
694 } // namespace content | 710 } // namespace content |
OLD | NEW |