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

Side by Side Diff: webkit/browser/appcache/appcache_update_job.cc

Issue 197043005: original change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix other build error Created 6 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/browser/appcache/appcache_update_job.h" 5 #include "webkit/browser/appcache/appcache_update_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // data out to the disk cache. 105 // data out to the disk cache.
106 AppCacheUpdateJob::URLFetcher::URLFetcher(const GURL& url, 106 AppCacheUpdateJob::URLFetcher::URLFetcher(const GURL& url,
107 FetchType fetch_type, 107 FetchType fetch_type,
108 AppCacheUpdateJob* job) 108 AppCacheUpdateJob* job)
109 : url_(url), 109 : url_(url),
110 job_(job), 110 job_(job),
111 fetch_type_(fetch_type), 111 fetch_type_(fetch_type),
112 retry_503_attempts_(0), 112 retry_503_attempts_(0),
113 buffer_(new net::IOBuffer(kBufferSize)), 113 buffer_(new net::IOBuffer(kBufferSize)),
114 request_(job->service_->request_context() 114 request_(job->service_->request_context()
115 ->CreateRequest(url, net::DEFAULT_PRIORITY, this)), 115 ->CreateRequest(url, net::DEFAULT_PRIORITY, this, NULL)),
116 result_(UPDATE_OK) {} 116 result_(UPDATE_OK) {}
117 117
118 AppCacheUpdateJob::URLFetcher::~URLFetcher() { 118 AppCacheUpdateJob::URLFetcher::~URLFetcher() {
119 } 119 }
120 120
121 void AppCacheUpdateJob::URLFetcher::Start() { 121 void AppCacheUpdateJob::URLFetcher::Start() {
122 request_->set_first_party_for_cookies(job_->manifest_url_); 122 request_->set_first_party_for_cookies(job_->manifest_url_);
123 request_->SetLoadFlags(request_->load_flags() | 123 request_->SetLoadFlags(request_->load_flags() |
124 net::LOAD_DISABLE_INTERCEPT); 124 net::LOAD_DISABLE_INTERCEPT);
125 if (existing_response_headers_.get()) 125 if (existing_response_headers_.get())
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 bool AppCacheUpdateJob::URLFetcher::MaybeRetryRequest() { 309 bool AppCacheUpdateJob::URLFetcher::MaybeRetryRequest() {
310 if (retry_503_attempts_ >= kMax503Retries || 310 if (retry_503_attempts_ >= kMax503Retries ||
311 !request_->response_headers()->HasHeaderValue("retry-after", "0")) { 311 !request_->response_headers()->HasHeaderValue("retry-after", "0")) {
312 return false; 312 return false;
313 } 313 }
314 ++retry_503_attempts_; 314 ++retry_503_attempts_;
315 result_ = UPDATE_OK; 315 result_ = UPDATE_OK;
316 request_ = job_->service_->request_context()->CreateRequest( 316 request_ = job_->service_->request_context()->CreateRequest(
317 url_, net::DEFAULT_PRIORITY, this); 317 url_, net::DEFAULT_PRIORITY, this, NULL);
318 Start(); 318 Start();
319 return true; 319 return true;
320 } 320 }
321 321
322 AppCacheUpdateJob::AppCacheUpdateJob(AppCacheService* service, 322 AppCacheUpdateJob::AppCacheUpdateJob(AppCacheService* service,
323 AppCacheGroup* group) 323 AppCacheGroup* group)
324 : service_(service), 324 : service_(service),
325 manifest_url_(group->manifest_url()), 325 manifest_url_(group->manifest_url()),
326 group_(group), 326 group_(group),
327 update_type_(UNKNOWN_TYPE), 327 update_type_(UNKNOWN_TYPE),
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 1425
1426 // Break the connection with the group so the group cannot call delete 1426 // Break the connection with the group so the group cannot call delete
1427 // on this object after we've posted a task to delete ourselves. 1427 // on this object after we've posted a task to delete ourselves.
1428 group_->SetUpdateStatus(AppCacheGroup::IDLE); 1428 group_->SetUpdateStatus(AppCacheGroup::IDLE);
1429 group_ = NULL; 1429 group_ = NULL;
1430 1430
1431 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1431 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1432 } 1432 }
1433 1433
1434 } // namespace appcache 1434 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698