Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Side by Side Diff: net/http/partial_data.h

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/http/http_byte_range.h" 10 #include "net/http/http_byte_range.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bool IsCurrentRangeCached() const; 65 bool IsCurrentRangeCached() const;
66 66
67 // Returns true if the current range is the last one needed to fulfill the 67 // Returns true if the current range is the last one needed to fulfill the
68 // user's request. 68 // user's request.
69 bool IsLastRange() const; 69 bool IsLastRange() const;
70 70
71 // Extracts info from headers already stored in the cache. Returns false if 71 // Extracts info from headers already stored in the cache. Returns false if
72 // there is any problem with the headers. |truncated| should be true if we 72 // there is any problem with the headers. |truncated| should be true if we
73 // have an incomplete 200 entry. 73 // have an incomplete 200 entry.
74 bool UpdateFromStoredHeaders(const HttpResponseHeaders* headers, 74 bool UpdateFromStoredHeaders(const HttpResponseHeaders* headers,
75 disk_cache::Entry* entry, bool truncated); 75 disk_cache::Entry* entry,
76 bool truncated);
76 77
77 // Sets the byte current range to start again at zero (for a truncated entry). 78 // Sets the byte current range to start again at zero (for a truncated entry).
78 void SetRangeToStartDownload(); 79 void SetRangeToStartDownload();
79 80
80 // Returns true if the requested range is valid given the stored data. 81 // Returns true if the requested range is valid given the stored data.
81 bool IsRequestedRangeOK(); 82 bool IsRequestedRangeOK();
82 83
83 // Returns true if the response headers match what we expect, false otherwise. 84 // Returns true if the response headers match what we expect, false otherwise.
84 bool ResponseHeadersOK(const HttpResponseHeaders* headers); 85 bool ResponseHeadersOK(const HttpResponseHeaders* headers);
85 86
86 // Fixes the response headers to include the right content length and range. 87 // Fixes the response headers to include the right content length and range.
87 // |success| is the result of the whole request so if it's false, we'll change 88 // |success| is the result of the whole request so if it's false, we'll change
88 // the result code to be 416. 89 // the result code to be 416.
89 void FixResponseHeaders(HttpResponseHeaders* headers, bool success); 90 void FixResponseHeaders(HttpResponseHeaders* headers, bool success);
90 91
91 // Fixes the content length that we want to store in the cache. 92 // Fixes the content length that we want to store in the cache.
92 void FixContentLength(HttpResponseHeaders* headers); 93 void FixContentLength(HttpResponseHeaders* headers);
93 94
94 // Reads up to |data_len| bytes from the cache and stores them in the provided 95 // Reads up to |data_len| bytes from the cache and stores them in the provided
95 // buffer (|data|). Basically, this is just a wrapper around the API of the 96 // buffer (|data|). Basically, this is just a wrapper around the API of the
96 // cache that provides the right arguments for the current range. When the IO 97 // cache that provides the right arguments for the current range. When the IO
97 // operation completes, OnCacheReadCompleted() must be called with the result 98 // operation completes, OnCacheReadCompleted() must be called with the result
98 // of the operation. 99 // of the operation.
99 int CacheRead(disk_cache::Entry* entry, IOBuffer* data, int data_len, 100 int CacheRead(disk_cache::Entry* entry,
101 IOBuffer* data,
102 int data_len,
100 const net::CompletionCallback& callback); 103 const net::CompletionCallback& callback);
101 104
102 // Writes |data_len| bytes to cache. This is basically a wrapper around the 105 // Writes |data_len| bytes to cache. This is basically a wrapper around the
103 // API of the cache that provides the right arguments for the current range. 106 // API of the cache that provides the right arguments for the current range.
104 int CacheWrite(disk_cache::Entry* entry, IOBuffer* data, int data_len, 107 int CacheWrite(disk_cache::Entry* entry,
108 IOBuffer* data,
109 int data_len,
105 const net::CompletionCallback& callback); 110 const net::CompletionCallback& callback);
106 111
107 // This method should be called when CacheRead() finishes the read, to update 112 // This method should be called when CacheRead() finishes the read, to update
108 // the internal state about the current range. 113 // the internal state about the current range.
109 void OnCacheReadCompleted(int result); 114 void OnCacheReadCompleted(int result);
110 115
111 // 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
112 // update the internal state about the current range. 117 // update the internal state about the current range.
113 void OnNetworkReadCompleted(int result); 118 void OnNetworkReadCompleted(int result);
114 119
(...skipping 10 matching lines...) Expand all
125 int64 current_range_start_; 130 int64 current_range_start_;
126 int64 cached_start_; 131 int64 cached_start_;
127 int64 resource_size_; 132 int64 resource_size_;
128 int cached_min_len_; 133 int cached_min_len_;
129 HttpByteRange byte_range_; // The range requested by the user. 134 HttpByteRange byte_range_; // The range requested by the user.
130 // The clean set of extra headers (no ranges). 135 // The clean set of extra headers (no ranges).
131 HttpRequestHeaders extra_headers_; 136 HttpRequestHeaders extra_headers_;
132 bool range_present_; // True if next range entry is already stored. 137 bool range_present_; // True if next range entry is already stored.
133 bool final_range_; 138 bool final_range_;
134 bool sparse_entry_; 139 bool sparse_entry_;
135 bool truncated_; // We have an incomplete 200 stored. 140 bool truncated_; // We have an incomplete 200 stored.
136 bool initial_validation_; // Only used for truncated entries. 141 bool initial_validation_; // Only used for truncated entries.
137 Core* core_; 142 Core* core_;
138 CompletionCallback callback_; 143 CompletionCallback callback_;
139 144
140 DISALLOW_COPY_AND_ASSIGN(PartialData); 145 DISALLOW_COPY_AND_ASSIGN(PartialData);
141 }; 146 };
142 147
143 } // namespace net 148 } // namespace net
144 149
145 #endif // NET_HTTP_PARTIAL_DATA_H_ 150 #endif // NET_HTTP_PARTIAL_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698