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

Side by Side Diff: webkit/appcache/appcache_url_request_job.cc

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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) 2010 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 #include <vector> 5 #include <vector>
6 6
7 #include "webkit/appcache/appcache_url_request_job.h" 7 #include "webkit/appcache/appcache_url_request_job.h"
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // To fallthru to the network, we restart the request which will 87 // To fallthru to the network, we restart the request which will
88 // cause a new job to be created to retrieve the resource from the 88 // cause a new job to be created to retrieve the resource from the
89 // network. Our caller is responsible for arranging to not re-intercept 89 // network. Our caller is responsible for arranging to not re-intercept
90 // the same request. 90 // the same request.
91 NotifyRestartRequired(); 91 NotifyRestartRequired();
92 break; 92 break;
93 93
94 case ERROR_DELIVERY: 94 case ERROR_DELIVERY:
95 request()->net_log().AddEvent( 95 request()->net_log().AddEvent(
96 net::NetLog::TYPE_APPCACHE_DELIVERING_ERROR_RESPONSE, NULL); 96 net::NetLog::TYPE_APPCACHE_DELIVERING_ERROR_RESPONSE, NULL);
97 NotifyStartError( 97 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
98 URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FAILED)); 98 net::ERR_FAILED));
99 break; 99 break;
100 100
101 case APPCACHED_DELIVERY: 101 case APPCACHED_DELIVERY:
102 request()->net_log().AddEvent( 102 request()->net_log().AddEvent(
103 is_fallback_ ? 103 is_fallback_ ?
104 net::NetLog::TYPE_APPCACHE_DELIVERING_FALLBACK_RESPONSE : 104 net::NetLog::TYPE_APPCACHE_DELIVERING_FALLBACK_RESPONSE :
105 net::NetLog::TYPE_APPCACHE_DELIVERING_CACHED_RESPONSE, 105 net::NetLog::TYPE_APPCACHE_DELIVERING_CACHED_RESPONSE,
106 NULL); 106 NULL);
107 storage_->LoadResponseInfo(manifest_url_, entry_.response_id(), this); 107 storage_->LoadResponseInfo(manifest_url_, entry_.response_id(), this);
108 break; 108 break;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 base::StringPrintf("%s: bytes %d-%d/%d", 181 base::StringPrintf("%s: bytes %d-%d/%d",
182 kRangeHeader, 182 kRangeHeader,
183 offset, 183 offset,
184 offset + length - 1, 184 offset + length - 1,
185 resource_size)); 185 resource_size));
186 } 186 }
187 187
188 void AppCacheURLRequestJob::OnReadComplete(int result) { 188 void AppCacheURLRequestJob::OnReadComplete(int result) {
189 DCHECK(is_delivering_appcache_response()); 189 DCHECK(is_delivering_appcache_response());
190 if (result == 0) 190 if (result == 0)
191 NotifyDone(URLRequestStatus()); 191 NotifyDone(net::URLRequestStatus());
192 else if (result < 0) 192 else if (result < 0)
193 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 193 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, result));
194 else 194 else
195 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status 195 SetStatus(net::URLRequestStatus()); // Clear the IO_PENDING status
196 196
197 NotifyReadComplete(result); 197 NotifyReadComplete(result);
198 } 198 }
199 199
200 // net::URLRequestJob overrides ------------------------------------------------ 200 // net::URLRequestJob overrides ------------------------------------------------
201 201
202 void AppCacheURLRequestJob::Start() { 202 void AppCacheURLRequestJob::Start() {
203 DCHECK(!has_been_started()); 203 DCHECK(!has_been_started());
204 has_been_started_ = true; 204 has_been_started_ = true;
205 MaybeBeginDelivery(); 205 MaybeBeginDelivery();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 return is_delivering_appcache_response(); 260 return is_delivering_appcache_response();
261 } 261 }
262 262
263 bool AppCacheURLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size, 263 bool AppCacheURLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size,
264 int *bytes_read) { 264 int *bytes_read) {
265 DCHECK(is_delivering_appcache_response()); 265 DCHECK(is_delivering_appcache_response());
266 DCHECK_NE(buf_size, 0); 266 DCHECK_NE(buf_size, 0);
267 DCHECK(bytes_read); 267 DCHECK(bytes_read);
268 DCHECK(!reader_->IsReadPending()); 268 DCHECK(!reader_->IsReadPending());
269 reader_->ReadData(buf, buf_size, &read_callback_); 269 reader_->ReadData(buf, buf_size, &read_callback_);
270 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); 270 SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
271 return false; 271 return false;
272 } 272 }
273 273
274 void AppCacheURLRequestJob::SetExtraRequestHeaders( 274 void AppCacheURLRequestJob::SetExtraRequestHeaders(
275 const net::HttpRequestHeaders& headers) { 275 const net::HttpRequestHeaders& headers) {
276 std::string value; 276 std::string value;
277 std::vector<net::HttpByteRange> ranges; 277 std::vector<net::HttpByteRange> ranges;
278 if (!headers.GetHeader(net::HttpRequestHeaders::kRange, &value) || 278 if (!headers.GetHeader(net::HttpRequestHeaders::kRange, &value) ||
279 !net::HttpUtil::ParseRangeHeader(value, &ranges)) { 279 !net::HttpUtil::ParseRangeHeader(value, &ranges)) {
280 return; 280 return;
281 } 281 }
282 282
283 // If multiple ranges are requested, we play dumb and 283 // If multiple ranges are requested, we play dumb and
284 // return the entire response with 200 OK. 284 // return the entire response with 200 OK.
285 if (ranges.size() == 1U) 285 if (ranges.size() == 1U)
286 range_requested_ = ranges[0]; 286 range_requested_ = ranges[0];
287 } 287 }
288 288
289 } // namespace appcache 289 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_request_handler.cc ('k') | webkit/appcache/appcache_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698