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 #include "net/http/partial_data.h" | 5 #include "net/http/partial_data.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/profiler/scoped_tracker.h" | |
12 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
15 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
16 #include "net/disk_cache/disk_cache.h" | 15 #include "net/disk_cache/disk_cache.h" |
17 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
18 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
19 | 18 |
20 namespace net { | 19 namespace net { |
21 | 20 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::Unretained(this))); | 82 base::Unretained(this))); |
84 if (rv != net::ERR_IO_PENDING) { | 83 if (rv != net::ERR_IO_PENDING) { |
85 // The callback will not be invoked. Lets cleanup. | 84 // The callback will not be invoked. Lets cleanup. |
86 *start = start_; | 85 *start = start_; |
87 delete this; | 86 delete this; |
88 } | 87 } |
89 return rv; | 88 return rv; |
90 } | 89 } |
91 | 90 |
92 void PartialData::Core::OnIOComplete(int result) { | 91 void PartialData::Core::OnIOComplete(int result) { |
93 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | |
94 tracked_objects::ScopedTracker tracking_profile( | |
95 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
96 "422516 PartialData::Core::OnIOComplete")); | |
97 | |
98 if (owner_) | 92 if (owner_) |
99 owner_->GetAvailableRangeCompleted(result, start_); | 93 owner_->GetAvailableRangeCompleted(result, start_); |
100 delete this; | 94 delete this; |
101 } | 95 } |
102 | 96 |
103 // ----------------------------------------------------------------------------- | 97 // ----------------------------------------------------------------------------- |
104 | 98 |
105 PartialData::PartialData() | 99 PartialData::PartialData() |
106 : current_range_start_(0), | 100 : current_range_start_(0), |
107 current_range_end_(0), | 101 current_range_end_(0), |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 cached_min_len_ = result; | 498 cached_min_len_ = result; |
505 if (result >= 0) | 499 if (result >= 0) |
506 result = 1; // Return success, go ahead and validate the entry. | 500 result = 1; // Return success, go ahead and validate the entry. |
507 | 501 |
508 CompletionCallback cb = callback_; | 502 CompletionCallback cb = callback_; |
509 callback_.Reset(); | 503 callback_.Reset(); |
510 cb.Run(result); | 504 cb.Run(result); |
511 } | 505 } |
512 | 506 |
513 } // namespace net | 507 } // namespace net |
OLD | NEW |