| 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" |
| 11 #include "base/file_path.h" |
| 11 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 12 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
| 15 #include "chrome/common/security_filter_peer.h" | 16 #include "chrome/common/security_filter_peer.h" |
| 16 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 17 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
| 18 #include "webkit/glue/resource_type.h" | 19 #include "webkit/glue/resource_type.h" |
| 19 #include "webkit/glue/webkit_glue.h" | 20 #include "webkit/glue/webkit_glue.h" |
| 20 | 21 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const std::string& default_mime_type, | 54 const std::string& default_mime_type, |
| 54 int load_flags, | 55 int load_flags, |
| 55 int origin_pid, | 56 int origin_pid, |
| 56 ResourceType::Type resource_type, | 57 ResourceType::Type resource_type, |
| 57 uint32 request_context, | 58 uint32 request_context, |
| 58 int route_id); | 59 int route_id); |
| 59 virtual ~IPCResourceLoaderBridge(); | 60 virtual ~IPCResourceLoaderBridge(); |
| 60 | 61 |
| 61 // ResourceLoaderBridge | 62 // ResourceLoaderBridge |
| 62 virtual void AppendDataToUpload(const char* data, int data_len); | 63 virtual void AppendDataToUpload(const char* data, int data_len); |
| 63 virtual void AppendFileRangeToUpload(const std::wstring& path, | 64 virtual void AppendFileRangeToUpload(const FilePath& path, |
| 64 uint64 offset, uint64 length); | 65 uint64 offset, uint64 length); |
| 65 virtual void SetUploadIdentifier(int64 identifier); | 66 virtual void SetUploadIdentifier(int64 identifier); |
| 66 virtual bool Start(Peer* peer); | 67 virtual bool Start(Peer* peer); |
| 67 virtual void Cancel(); | 68 virtual void Cancel(); |
| 68 virtual void SetDefersLoading(bool value); | 69 virtual void SetDefersLoading(bool value); |
| 69 virtual void SyncLoad(SyncLoadResponse* response); | 70 virtual void SyncLoad(SyncLoadResponse* response); |
| 70 | 71 |
| 71 #ifdef LOG_RESOURCE_REQUESTS | 72 #ifdef LOG_RESOURCE_REQUESTS |
| 72 const std::string& url() const { return url_; } | 73 const std::string& url() const { return url_; } |
| 73 #endif | 74 #endif |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // don't bother appending empty data segments | 151 // don't bother appending empty data segments |
| 151 if (data_len == 0) | 152 if (data_len == 0) |
| 152 return; | 153 return; |
| 153 | 154 |
| 154 if (!request_.upload_data) | 155 if (!request_.upload_data) |
| 155 request_.upload_data = new net::UploadData(); | 156 request_.upload_data = new net::UploadData(); |
| 156 request_.upload_data->AppendBytes(data, data_len); | 157 request_.upload_data->AppendBytes(data, data_len); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void IPCResourceLoaderBridge::AppendFileRangeToUpload( | 160 void IPCResourceLoaderBridge::AppendFileRangeToUpload( |
| 160 const std::wstring& path, uint64 offset, uint64 length) { | 161 const FilePath& path, uint64 offset, uint64 length) { |
| 161 DCHECK(request_id_ == -1) << "request already started"; | 162 DCHECK(request_id_ == -1) << "request already started"; |
| 162 | 163 |
| 163 if (!request_.upload_data) | 164 if (!request_.upload_data) |
| 164 request_.upload_data = new net::UploadData(); | 165 request_.upload_data = new net::UploadData(); |
| 165 request_.upload_data->AppendFileRange(path, offset, length); | 166 request_.upload_data->AppendFileRange(path, offset, length); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { | 169 void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) { |
| 169 DCHECK(request_id_ == -1) << "request already started"; | 170 DCHECK(request_id_ == -1) << "request already started"; |
| 170 | 171 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 case ViewMsg_Resource_DataReceived::ID: | 551 case ViewMsg_Resource_DataReceived::ID: |
| 551 case ViewMsg_Resource_RequestComplete::ID: | 552 case ViewMsg_Resource_RequestComplete::ID: |
| 552 return true; | 553 return true; |
| 553 | 554 |
| 554 default: | 555 default: |
| 555 break; | 556 break; |
| 556 } | 557 } |
| 557 | 558 |
| 558 return false; | 559 return false; |
| 559 } | 560 } |
| OLD | NEW |