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 "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 // the internal state about the current range. | 113 // the internal state about the current range. |
114 void OnCacheReadCompleted(int result); | 114 void OnCacheReadCompleted(int result); |
115 | 115 |
116 // This method should be called after receiving data from the network, to | 116 // This method should be called after receiving data from the network, to |
117 // update the internal state about the current range. | 117 // update the internal state about the current range. |
118 void OnNetworkReadCompleted(int result); | 118 void OnNetworkReadCompleted(int result); |
119 | 119 |
120 bool initial_validation() const { return initial_validation_; } | 120 bool initial_validation() const { return initial_validation_; } |
121 | 121 |
122 private: | 122 private: |
123 // Returned by GetNextRangeLen() to indicate that the next range extends to | |
124 // EOF. | |
125 static const int64 kUnbounded; | |
rvargas (doing something else)
2015/07/27 22:25:12
does this has to be part of the header? (as oppose
asanka
2015/08/18 22:46:59
Moved to anon namespace.
| |
126 | |
123 // Returns the length to use when scanning the cache. | 127 // Returns the length to use when scanning the cache. |
124 int GetNextRangeLen(); | 128 int64 GetNextRangeLen(); |
125 | 129 |
126 // Completion routine for our callback. | 130 // Completion routine for our callback. |
127 void GetAvailableRangeCompleted(int64* start, int result); | 131 void GetAvailableRangeCompleted(int64* start, int result); |
128 | 132 |
129 int64 current_range_start_; | 133 int64 current_range_start_; |
130 int64 current_range_end_; | 134 int64 current_range_end_; |
131 int64 cached_start_; | 135 int64 cached_start_; |
132 int64 resource_size_; | 136 int64 resource_size_; |
133 int cached_min_len_; | 137 int64 cached_min_len_; |
134 HttpByteRange byte_range_; // The range requested by the user. | 138 HttpByteRange byte_range_; // The range requested by the user. |
135 // The clean set of extra headers (no ranges). | 139 // The clean set of extra headers (no ranges). |
136 HttpRequestHeaders extra_headers_; | 140 HttpRequestHeaders extra_headers_; |
137 bool range_present_; // True if next range entry is already stored. | 141 bool range_present_; // True if next range entry is already stored. |
138 bool final_range_; | 142 bool final_range_; |
139 bool sparse_entry_; | 143 bool sparse_entry_; |
140 bool truncated_; // We have an incomplete 200 stored. | 144 bool truncated_; // We have an incomplete 200 stored. |
141 bool initial_validation_; // Only used for truncated entries. | 145 bool initial_validation_; // Only used for truncated entries. |
142 CompletionCallback callback_; | 146 CompletionCallback callback_; |
143 base::WeakPtrFactory<PartialData> weak_factory_; | 147 base::WeakPtrFactory<PartialData> weak_factory_; |
144 | 148 |
145 DISALLOW_COPY_AND_ASSIGN(PartialData); | 149 DISALLOW_COPY_AND_ASSIGN(PartialData); |
146 }; | 150 }; |
147 | 151 |
148 } // namespace net | 152 } // namespace net |
149 | 153 |
150 #endif // NET_HTTP_PARTIAL_DATA_H_ | 154 #endif // NET_HTTP_PARTIAL_DATA_H_ |
OLD | NEW |