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

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 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/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/base/net_log.h" 13 #include "net/base/net_log.h"
14 #include "net/http/http_request_headers.h" 14 #include "net/http/http_request_headers.h"
15 #include "net/http/http_response_headers.h" 15 #include "net/http/http_response_headers.h"
16 #include "net/http/http_util.h" 16 #include "net/http/http_util.h"
17 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_status.h" 18 #include "net/url_request/url_request_status.h"
19 19
20 namespace appcache { 20 namespace appcache {
21 21
22 AppCacheURLRequestJob::AppCacheURLRequestJob( 22 AppCacheURLRequestJob::AppCacheURLRequestJob(
23 net::URLRequest* request, AppCacheStorage* storage) 23 net::URLRequest* request, AppCacheStorage* storage)
24 : URLRequestJob(request), storage_(storage), 24 : net::URLRequestJob(request), storage_(storage),
25 has_been_started_(false), has_been_killed_(false), 25 has_been_started_(false), has_been_killed_(false),
26 delivery_type_(AWAITING_DELIVERY_ORDERS), 26 delivery_type_(AWAITING_DELIVERY_ORDERS),
27 cache_id_(kNoCacheId), is_fallback_(false), 27 cache_id_(kNoCacheId), is_fallback_(false),
28 cache_entry_not_found_(false), 28 cache_entry_not_found_(false),
29 ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_( 29 ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_(
30 this, &AppCacheURLRequestJob::OnReadComplete)) { 30 this, &AppCacheURLRequestJob::OnReadComplete)) {
31 DCHECK(storage_); 31 DCHECK(storage_);
32 } 32 }
33 33
34 AppCacheURLRequestJob::~AppCacheURLRequestJob() { 34 AppCacheURLRequestJob::~AppCacheURLRequestJob() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (result == 0) 186 if (result == 0)
187 NotifyDone(URLRequestStatus()); 187 NotifyDone(URLRequestStatus());
188 else if (result < 0) 188 else if (result < 0)
189 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result)); 189 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
190 else 190 else
191 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status 191 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status
192 192
193 NotifyReadComplete(result); 193 NotifyReadComplete(result);
194 } 194 }
195 195
196 // URLRequestJob overrides ------------------------------------------------ 196 // net::URLRequestJob overrides ------------------------------------------------
197 197
198 void AppCacheURLRequestJob::Start() { 198 void AppCacheURLRequestJob::Start() {
199 DCHECK(!has_been_started()); 199 DCHECK(!has_been_started());
200 has_been_started_ = true; 200 has_been_started_ = true;
201 MaybeBeginDelivery(); 201 MaybeBeginDelivery();
202 } 202 }
203 203
204 void AppCacheURLRequestJob::Kill() { 204 void AppCacheURLRequestJob::Kill() {
205 if (!has_been_killed_) { 205 if (!has_been_killed_) {
206 has_been_killed_ = true; 206 has_been_killed_ = true;
207 reader_.reset(); 207 reader_.reset();
208 if (storage_) { 208 if (storage_) {
209 storage_->CancelDelegateCallbacks(this); 209 storage_->CancelDelegateCallbacks(this);
210 storage_ = NULL; 210 storage_ = NULL;
211 } 211 }
212 URLRequestJob::Kill(); 212 net::URLRequestJob::Kill();
213 } 213 }
214 } 214 }
215 215
216 net::LoadState AppCacheURLRequestJob::GetLoadState() const { 216 net::LoadState AppCacheURLRequestJob::GetLoadState() const {
217 if (!has_been_started()) 217 if (!has_been_started())
218 return net::LOAD_STATE_IDLE; 218 return net::LOAD_STATE_IDLE;
219 if (!has_delivery_orders()) 219 if (!has_delivery_orders())
220 return net::LOAD_STATE_WAITING_FOR_CACHE; 220 return net::LOAD_STATE_WAITING_FOR_CACHE;
221 if (delivery_type_ != APPCACHED_DELIVERY) 221 if (delivery_type_ != APPCACHED_DELIVERY)
222 return net::LOAD_STATE_IDLE; 222 return net::LOAD_STATE_IDLE;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 273
274 // If multiple ranges are requested, we play dumb and 274 // If multiple ranges are requested, we play dumb and
275 // return the entire response with 200 OK. 275 // return the entire response with 200 OK.
276 if (ranges.size() == 1U) 276 if (ranges.size() == 1U)
277 range_requested_ = ranges[0]; 277 range_requested_ = ranges[0];
278 } 278 }
279 279
280 } // namespace appcache 280 } // namespace appcache
281 281
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698