| 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 #include "net/http/partial_data.h" | 5 #include "net/http/partial_data.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 void PartialData::Core::OnIOComplete(int result) { | 101 void PartialData::Core::OnIOComplete(int result) { |
| 102 if (owner_) | 102 if (owner_) |
| 103 owner_->GetAvailableRangeCompleted(result, start_); | 103 owner_->GetAvailableRangeCompleted(result, start_); |
| 104 delete this; | 104 delete this; |
| 105 } | 105 } |
| 106 | 106 |
| 107 // ----------------------------------------------------------------------------- | 107 // ----------------------------------------------------------------------------- |
| 108 | 108 |
| 109 PartialData::PartialData() |
| 110 : range_present_(false), |
| 111 final_range_(false), |
| 112 sparse_entry_(true), |
| 113 truncated_(false), |
| 114 core_(NULL), |
| 115 callback_(NULL) { |
| 116 } |
| 117 |
| 109 PartialData::~PartialData() { | 118 PartialData::~PartialData() { |
| 110 if (core_) | 119 if (core_) |
| 111 core_->Cancel(); | 120 core_->Cancel(); |
| 112 } | 121 } |
| 113 | 122 |
| 114 bool PartialData::Init(const HttpRequestHeaders& headers) { | 123 bool PartialData::Init(const HttpRequestHeaders& headers) { |
| 115 std::string range_header; | 124 std::string range_header; |
| 116 if (!headers.GetHeader(HttpRequestHeaders::kRange, &range_header)) | 125 if (!headers.GetHeader(HttpRequestHeaders::kRange, &range_header)) |
| 117 return false; | 126 return false; |
| 118 | 127 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 cached_min_len_ = result; | 470 cached_min_len_ = result; |
| 462 if (result >= 0) | 471 if (result >= 0) |
| 463 result = 1; // Return success, go ahead and validate the entry. | 472 result = 1; // Return success, go ahead and validate the entry. |
| 464 | 473 |
| 465 CompletionCallback* cb = callback_; | 474 CompletionCallback* cb = callback_; |
| 466 callback_ = NULL; | 475 callback_ = NULL; |
| 467 cb->Run(result); | 476 cb->Run(result); |
| 468 } | 477 } |
| 469 | 478 |
| 470 } // namespace net | 479 } // namespace net |
| OLD | NEW |