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

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

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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
« no previous file with comments | « webkit/appcache/appcache_unittest.cc ('k') | webkit/appcache/appcache_update_job_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/appcache/appcache_update_job.h" 5 #include "webkit/appcache/appcache_update_job.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 (request->GetResponseCode() / 100) == 2) { 346 (request->GetResponseCode() / 100) == 2) {
347 // Write response info to storage for URL fetches. Wait for async write 347 // Write response info to storage for URL fetches. Wait for async write
348 // completion before reading any response data. 348 // completion before reading any response data.
349 UpdateJobInfo* info = GetUpdateJobInfo(request); 349 UpdateJobInfo* info = GetUpdateJobInfo(request);
350 if (info->type_ == UpdateJobInfo::URL_FETCH || 350 if (info->type_ == UpdateJobInfo::URL_FETCH ||
351 info->type_ == UpdateJobInfo::MASTER_ENTRY_FETCH) { 351 info->type_ == UpdateJobInfo::MASTER_ENTRY_FETCH) {
352 info->SetUpResponseWriter( 352 info->SetUpResponseWriter(
353 service_->storage()->CreateResponseWriter(manifest_url_), 353 service_->storage()->CreateResponseWriter(manifest_url_),
354 this, request); 354 this, request);
355 stored_response_ids_.push_back(info->response_writer_->response_id()); 355 stored_response_ids_.push_back(info->response_writer_->response_id());
356 scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = 356 scoped_refptr<HttpResponseInfoIOBuffer> io_buffer(
357 new HttpResponseInfoIOBuffer( 357 new HttpResponseInfoIOBuffer(
358 new net::HttpResponseInfo(request->response_info())); 358 new net::HttpResponseInfo(request->response_info())));
359 info->response_writer_->WriteInfo(io_buffer, &info->write_callback_); 359 info->response_writer_->WriteInfo(io_buffer, &info->write_callback_);
360 } else { 360 } else {
361 ReadResponseData(request); 361 ReadResponseData(request);
362 } 362 }
363 } else { 363 } else {
364 OnResponseCompleted(request); 364 OnResponseCompleted(request);
365 } 365 }
366 } 366 }
367 367
368 void AppCacheUpdateJob::ReadResponseData(URLRequest* request) { 368 void AppCacheUpdateJob::ReadResponseData(URLRequest* request) {
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 // Only need to store response in storage if manifest is not already 775 // Only need to store response in storage if manifest is not already
776 // an entry in the cache. 776 // an entry in the cache.
777 AppCacheEntry* entry = inprogress_cache_->GetEntry(manifest_url_); 777 AppCacheEntry* entry = inprogress_cache_->GetEntry(manifest_url_);
778 if (entry) { 778 if (entry) {
779 entry->add_types(AppCacheEntry::MANIFEST); 779 entry->add_types(AppCacheEntry::MANIFEST);
780 StoreGroupAndCache(); 780 StoreGroupAndCache();
781 } else { 781 } else {
782 manifest_response_writer_.reset( 782 manifest_response_writer_.reset(
783 service_->storage()->CreateResponseWriter(manifest_url_)); 783 service_->storage()->CreateResponseWriter(manifest_url_));
784 stored_response_ids_.push_back(manifest_response_writer_->response_id()); 784 stored_response_ids_.push_back(manifest_response_writer_->response_id());
785 scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = 785 scoped_refptr<HttpResponseInfoIOBuffer> io_buffer(
786 new HttpResponseInfoIOBuffer(manifest_response_info_.release()); 786 new HttpResponseInfoIOBuffer(manifest_response_info_.release()));
787 manifest_response_writer_->WriteInfo(io_buffer, 787 manifest_response_writer_->WriteInfo(io_buffer,
788 &manifest_info_write_callback_); 788 &manifest_info_write_callback_);
789 } 789 }
790 } else { 790 } else {
791 VLOG(1) << "Request status: " << request->status().status() 791 VLOG(1) << "Request status: " << request->status().status()
792 << " os_error: " << request->status().os_error() 792 << " os_error: " << request->status().os_error()
793 << " response code: " << response_code; 793 << " response code: " << response_code;
794 ScheduleUpdateRetry(kRerunDelayMs); 794 ScheduleUpdateRetry(kRerunDelayMs);
795 HandleCacheFailure("Manifest changed during update, scheduling retry"); 795 HandleCacheFailure("Manifest changed during update, scheduling retry");
796 } 796 }
797 } 797 }
798 798
799 void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) { 799 void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) {
800 if (result > 0) { 800 if (result > 0) {
801 scoped_refptr<net::StringIOBuffer> io_buffer = 801 scoped_refptr<net::StringIOBuffer> io_buffer(
802 new net::StringIOBuffer(manifest_data_); 802 new net::StringIOBuffer(manifest_data_));
803 manifest_response_writer_->WriteData(io_buffer, manifest_data_.length(), 803 manifest_response_writer_->WriteData(io_buffer, manifest_data_.length(),
804 &manifest_data_write_callback_); 804 &manifest_data_write_callback_);
805 } else { 805 } else {
806 HandleCacheFailure("Failed to write the manifest headers to storage"); 806 HandleCacheFailure("Failed to write the manifest headers to storage");
807 } 807 }
808 } 808 }
809 809
810 void AppCacheUpdateJob::OnManifestDataWriteComplete(int result) { 810 void AppCacheUpdateJob::OnManifestDataWriteComplete(int result) {
811 if (result > 0) { 811 if (result > 0) {
812 AppCacheEntry entry(AppCacheEntry::MANIFEST, 812 AppCacheEntry entry(AppCacheEntry::MANIFEST,
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 1405
1406 // Break the connection with the group so the group cannot call delete 1406 // Break the connection with the group so the group cannot call delete
1407 // on this object after we've posted a task to delete ourselves. 1407 // on this object after we've posted a task to delete ourselves.
1408 group_->SetUpdateStatus(AppCacheGroup::IDLE); 1408 group_->SetUpdateStatus(AppCacheGroup::IDLE);
1409 group_ = NULL; 1409 group_ = NULL;
1410 1410
1411 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1411 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1412 } 1412 }
1413 1413
1414 } // namespace appcache 1414 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_unittest.cc ('k') | webkit/appcache/appcache_update_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698