| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #include "net/url_request/url_request.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 GetJobManager()->UnregisterRequestInterceptor(interceptor); | 79 GetJobManager()->UnregisterRequestInterceptor(interceptor); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void URLRequest::AppendBytesToUpload(const char* bytes, int bytes_len) { | 82 void URLRequest::AppendBytesToUpload(const char* bytes, int bytes_len) { |
| 83 DCHECK(bytes_len > 0 && bytes); | 83 DCHECK(bytes_len > 0 && bytes); |
| 84 if (!upload_) | 84 if (!upload_) |
| 85 upload_ = new UploadData(); | 85 upload_ = new UploadData(); |
| 86 upload_->AppendBytes(bytes, bytes_len); | 86 upload_->AppendBytes(bytes, bytes_len); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void URLRequest::AppendFileRangeToUpload(const FilePath& file_path, | 89 void URLRequest::AppendFileRangeToUpload( |
| 90 uint64 offset, uint64 length) { | 90 const FilePath& file_path, |
| 91 uint64 offset, |
| 92 uint64 length, |
| 93 const base::Time& expected_modification_time) { |
| 91 DCHECK(file_path.value().length() > 0 && length > 0); | 94 DCHECK(file_path.value().length() > 0 && length > 0); |
| 92 if (!upload_) | 95 if (!upload_) |
| 93 upload_ = new UploadData(); | 96 upload_ = new UploadData(); |
| 94 upload_->AppendFileRange(file_path, offset, length); | 97 upload_->AppendFileRange(file_path, offset, length, |
| 98 expected_modification_time); |
| 95 } | 99 } |
| 96 | 100 |
| 97 void URLRequest::set_upload(net::UploadData* upload) { | 101 void URLRequest::set_upload(net::UploadData* upload) { |
| 98 upload_ = upload; | 102 upload_ = upload; |
| 99 } | 103 } |
| 100 | 104 |
| 101 // Get the upload data directly. | 105 // Get the upload data directly. |
| 102 net::UploadData* URLRequest::get_upload() { | 106 net::UploadData* URLRequest::get_upload() { |
| 103 return upload_.get(); | 107 return upload_.get(); |
| 104 } | 108 } |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { | 533 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { |
| 530 UserDataMap::const_iterator found = user_data_.find(key); | 534 UserDataMap::const_iterator found = user_data_.find(key); |
| 531 if (found != user_data_.end()) | 535 if (found != user_data_.end()) |
| 532 return found->second.get(); | 536 return found->second.get(); |
| 533 return NULL; | 537 return NULL; |
| 534 } | 538 } |
| 535 | 539 |
| 536 void URLRequest::SetUserData(const void* key, UserData* data) { | 540 void URLRequest::SetUserData(const void* key, UserData* data) { |
| 537 user_data_[key] = linked_ptr<UserData>(data); | 541 user_data_[key] = linked_ptr<UserData>(data); |
| 538 } | 542 } |
| OLD | NEW |