OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 class IPCResourceLoaderBridge : public ResourceLoaderBridge { | 45 class IPCResourceLoaderBridge : public ResourceLoaderBridge { |
46 public: | 46 public: |
47 IPCResourceLoaderBridge(ResourceDispatcher* dispatcher, | 47 IPCResourceLoaderBridge(ResourceDispatcher* dispatcher, |
48 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, | 48 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info, |
49 int host_renderer_id, | 49 int host_renderer_id, |
50 int host_render_view_id); | 50 int host_render_view_id); |
51 virtual ~IPCResourceLoaderBridge(); | 51 virtual ~IPCResourceLoaderBridge(); |
52 | 52 |
53 // ResourceLoaderBridge | 53 // ResourceLoaderBridge |
54 virtual void AppendDataToUpload(const char* data, int data_len); | 54 virtual void AppendDataToUpload(const char* data, int data_len); |
55 virtual void AppendFileRangeToUpload(const FilePath& path, | 55 virtual void AppendFileRangeToUpload( |
56 uint64 offset, uint64 length); | 56 const FilePath& path, |
| 57 uint64 offset, |
| 58 uint64 length, |
| 59 const base::Time& expected_modification_time); |
57 virtual void SetUploadIdentifier(int64 identifier); | 60 virtual void SetUploadIdentifier(int64 identifier); |
58 virtual bool Start(Peer* peer); | 61 virtual bool Start(Peer* peer); |
59 virtual void Cancel(); | 62 virtual void Cancel(); |
60 virtual void SetDefersLoading(bool value); | 63 virtual void SetDefersLoading(bool value); |
61 virtual void SyncLoad(SyncLoadResponse* response); | 64 virtual void SyncLoad(SyncLoadResponse* response); |
62 | 65 |
63 #ifdef LOG_RESOURCE_REQUESTS | 66 #ifdef LOG_RESOURCE_REQUESTS |
64 const std::string& url() const { return url_; } | 67 const std::string& url() const { return url_; } |
65 #endif | 68 #endif |
66 | 69 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // don't bother appending empty data segments | 148 // don't bother appending empty data segments |
146 if (data_len == 0) | 149 if (data_len == 0) |
147 return; | 150 return; |
148 | 151 |
149 if (!request_.upload_data) | 152 if (!request_.upload_data) |
150 request_.upload_data = new net::UploadData(); | 153 request_.upload_data = new net::UploadData(); |
151 request_.upload_data->AppendBytes(data, data_len); | 154 request_.upload_data->AppendBytes(data, data_len); |
152 } | 155 } |
153 | 156 |
154 void IPCResourceLoaderBridge::AppendFileRangeToUpload( | 157 void IPCResourceLoaderBridge::AppendFileRangeToUpload( |
155 const FilePath& path, uint64 offset, uint64 length) { | 158 const FilePath& path, uint64 offset, uint64 length, |
| 159 const base::Time& expected_modification_time) { |
156 DCHECK(request_id_ == -1) << "request already started"; | 160 DCHECK(request_id_ == -1) << "request already started"; |
157 | 161 |
158 if (!request_.upload_data) | 162 if (!request_.upload_data) |
159 request_.upload_data = new net::UploadData(); | 163 request_.upload_data = new net::UploadData(); |
160 request_.upload_data->AppendFileRange(path, offset, length); | 164 request_.upload_data->AppendFileRange(path, offset, length, |
| 165 expected_modification_time); |
161 } | 166 } |
162 | 167 |
163 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { | 168 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { |
164 DCHECK(request_id_ == -1) << "request already started"; | 169 DCHECK(request_id_ == -1) << "request already started"; |
165 | 170 |
166 if (!request_.upload_data) | 171 if (!request_.upload_data) |
167 request_.upload_data = new net::UploadData(); | 172 request_.upload_data = new net::UploadData(); |
168 request_.upload_data->set_identifier(identifier); | 173 request_.upload_data->set_identifier(identifier); |
169 } | 174 } |
170 | 175 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 // handle or there will be a memory leak. | 611 // handle or there will be a memory leak. |
607 if (message.type() == ViewMsg_Resource_DataReceived::ID) { | 612 if (message.type() == ViewMsg_Resource_DataReceived::ID) { |
608 base::SharedMemoryHandle shm_handle; | 613 base::SharedMemoryHandle shm_handle; |
609 if (IPC::ParamTraits<base::SharedMemoryHandle>::Read(&message, | 614 if (IPC::ParamTraits<base::SharedMemoryHandle>::Read(&message, |
610 &iter, | 615 &iter, |
611 &shm_handle)) { | 616 &shm_handle)) { |
612 base::SharedMemory::CloseHandle(shm_handle); | 617 base::SharedMemory::CloseHandle(shm_handle); |
613 } | 618 } |
614 } | 619 } |
615 } | 620 } |
OLD | NEW |