| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_HTTP_PARTIAL_DATA_H_ | 5 #ifndef NET_HTTP_PARTIAL_DATA_H_ |
| 6 #define NET_HTTP_PARTIAL_DATA_H_ | 6 #define NET_HTTP_PARTIAL_DATA_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 10 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 11 #include "net/http/http_byte_range.h" | 13 #include "net/http/http_byte_range.h" |
| 12 #include "net/http/http_request_headers.h" | 14 #include "net/http/http_request_headers.h" |
| 13 | 15 |
| 14 namespace disk_cache { | 16 namespace disk_cache { |
| 15 class Entry; | 17 class Entry; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // update the internal state about the current range. | 119 // update the internal state about the current range. |
| 118 void OnNetworkReadCompleted(int result); | 120 void OnNetworkReadCompleted(int result); |
| 119 | 121 |
| 120 bool initial_validation() const { return initial_validation_; } | 122 bool initial_validation() const { return initial_validation_; } |
| 121 | 123 |
| 122 private: | 124 private: |
| 123 // Returns the length to use when scanning the cache. | 125 // Returns the length to use when scanning the cache. |
| 124 int GetNextRangeLen(); | 126 int GetNextRangeLen(); |
| 125 | 127 |
| 126 // Completion routine for our callback. | 128 // Completion routine for our callback. |
| 127 void GetAvailableRangeCompleted(int64* start, int result); | 129 void GetAvailableRangeCompleted(int64_t* start, int result); |
| 128 | 130 |
| 129 int64 current_range_start_; | 131 int64_t current_range_start_; |
| 130 int64 current_range_end_; | 132 int64_t current_range_end_; |
| 131 int64 cached_start_; | 133 int64_t cached_start_; |
| 132 int64 resource_size_; | 134 int64_t resource_size_; |
| 133 int cached_min_len_; | 135 int cached_min_len_; |
| 134 HttpByteRange byte_range_; // The range requested by the user. | 136 HttpByteRange byte_range_; // The range requested by the user. |
| 135 // The clean set of extra headers (no ranges). | 137 // The clean set of extra headers (no ranges). |
| 136 HttpRequestHeaders extra_headers_; | 138 HttpRequestHeaders extra_headers_; |
| 137 bool range_present_; // True if next range entry is already stored. | 139 bool range_present_; // True if next range entry is already stored. |
| 138 bool final_range_; | 140 bool final_range_; |
| 139 bool sparse_entry_; | 141 bool sparse_entry_; |
| 140 bool truncated_; // We have an incomplete 200 stored. | 142 bool truncated_; // We have an incomplete 200 stored. |
| 141 bool initial_validation_; // Only used for truncated entries. | 143 bool initial_validation_; // Only used for truncated entries. |
| 142 CompletionCallback callback_; | 144 CompletionCallback callback_; |
| 143 base::WeakPtrFactory<PartialData> weak_factory_; | 145 base::WeakPtrFactory<PartialData> weak_factory_; |
| 144 | 146 |
| 145 DISALLOW_COPY_AND_ASSIGN(PartialData); | 147 DISALLOW_COPY_AND_ASSIGN(PartialData); |
| 146 }; | 148 }; |
| 147 | 149 |
| 148 } // namespace net | 150 } // namespace net |
| 149 | 151 |
| 150 #endif // NET_HTTP_PARTIAL_DATA_H_ | 152 #endif // NET_HTTP_PARTIAL_DATA_H_ |
| OLD | NEW |