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

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

Issue 5607004: net: Remove typedef net::URLRequestJob URLRequestJob; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 2 Created 10 years 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) 2010 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"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/base/net_log.h" 14 #include "net/base/net_log.h"
15 #include "net/http/http_request_headers.h" 15 #include "net/http/http_request_headers.h"
16 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
17 #include "net/http/http_util.h" 17 #include "net/http/http_util.h"
18 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
19 #include "net/url_request/url_request_status.h" 19 #include "net/url_request/url_request_status.h"
20 20
21 namespace appcache { 21 namespace appcache {
22 22
23 AppCacheURLRequestJob::AppCacheURLRequestJob( 23 AppCacheURLRequestJob::AppCacheURLRequestJob(
24 net::URLRequest* request, AppCacheStorage* storage) 24 net::URLRequest* request, AppCacheStorage* storage)
25 : URLRequestJob(request), storage_(storage), 25 : net::URLRequestJob(request), storage_(storage),
26 has_been_started_(false), has_been_killed_(false), 26 has_been_started_(false), has_been_killed_(false),
27 delivery_type_(AWAITING_DELIVERY_ORDERS), 27 delivery_type_(AWAITING_DELIVERY_ORDERS),
28 cache_id_(kNoCacheId), is_fallback_(false), 28 cache_id_(kNoCacheId), is_fallback_(false),
29 cache_entry_not_found_(false), 29 cache_entry_not_found_(false),
30 ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_( 30 ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_(
31 this, &AppCacheURLRequestJob::OnReadComplete)), 31 this, &AppCacheURLRequestJob::OnReadComplete)),
32 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { 32 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
33 DCHECK(storage_); 33 DCHECK(storage_);
34 } 34 }
35 35
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (result == 0) 190 if (result == 0)
191 NotifyDone(URLRequestStatus()); 191 NotifyDone(URLRequestStatus());
192 else if (result < 0) 192 else if (result < 0)
193 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 193 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
194 else 194 else
195 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status 195 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status
196 196
197 NotifyReadComplete(result); 197 NotifyReadComplete(result);
198 } 198 }
199 199
200 // 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();
206 } 206 }
207 207
208 void AppCacheURLRequestJob::Kill() { 208 void AppCacheURLRequestJob::Kill() {
209 if (!has_been_killed_) { 209 if (!has_been_killed_) {
210 has_been_killed_ = true; 210 has_been_killed_ = true;
211 reader_.reset(); 211 reader_.reset();
212 if (storage_) { 212 if (storage_) {
213 storage_->CancelDelegateCallbacks(this); 213 storage_->CancelDelegateCallbacks(this);
214 storage_ = NULL; 214 storage_ = NULL;
215 } 215 }
216 URLRequestJob::Kill(); 216 net::URLRequestJob::Kill();
217 method_factory_.RevokeAll(); 217 method_factory_.RevokeAll();
218 } 218 }
219 } 219 }
220 220
221 net::LoadState AppCacheURLRequestJob::GetLoadState() const { 221 net::LoadState AppCacheURLRequestJob::GetLoadState() const {
222 if (!has_been_started()) 222 if (!has_been_started())
223 return net::LOAD_STATE_IDLE; 223 return net::LOAD_STATE_IDLE;
224 if (!has_delivery_orders()) 224 if (!has_delivery_orders())
225 return net::LOAD_STATE_WAITING_FOR_CACHE; 225 return net::LOAD_STATE_WAITING_FOR_CACHE;
226 if (delivery_type_ != APPCACHED_DELIVERY) 226 if (delivery_type_ != APPCACHED_DELIVERY)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 return; 276 return;
277 } 277 }
278 278
279 // If multiple ranges are requested, we play dumb and 279 // If multiple ranges are requested, we play dumb and
280 // return the entire response with 200 OK. 280 // return the entire response with 200 OK.
281 if (ranges.size() == 1U) 281 if (ranges.size() == 1U)
282 range_requested_ = ranges[0]; 282 range_requested_ = ranges[0];
283 } 283 }
284 284
285 } // namespace appcache 285 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_url_request_job.h ('k') | webkit/appcache/appcache_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698