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

Unified Diff: webkit/appcache/appcache_update_job.cc

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_unittest.cc ('k') | webkit/appcache/appcache_url_request_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_update_job.cc
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc
index 10929042e6aed2cda1935604c1c74a778328ff23..cf68fc4e1436be2e26125e139a89c3d28db1038d 100644
--- a/webkit/appcache/appcache_update_job.cc
+++ b/webkit/appcache/appcache_update_job.cc
@@ -109,8 +109,8 @@ void AppCacheUpdateJob::URLFetcher::Start() {
request_->set_first_party_for_cookies(job_->manifest_url_);
request_->set_load_flags(request_->load_flags() |
net::LOAD_DISABLE_INTERCEPT);
- if (existing_response_headers_)
- AddConditionalHeaders(existing_response_headers_);
+ if (existing_response_headers_.get())
+ AddConditionalHeaders(existing_response_headers_.get());
request_->Start();
}
@@ -153,7 +153,7 @@ void AppCacheUpdateJob::URLFetcher::OnResponseStarted(
new HttpResponseInfoIOBuffer(
new net::HttpResponseInfo(request->response_info())));
response_writer_->WriteInfo(
- io_buffer,
+ io_buffer.get(),
base::Bind(&URLFetcher::OnWriteComplete, base::Unretained(this)));
} else {
ReadResponseData();
@@ -171,7 +171,7 @@ void AppCacheUpdateJob::URLFetcher::OnReadCompleted(
data_consumed = ConsumeResponseData(bytes_read);
if (data_consumed) {
bytes_read = 0;
- while (request->Read(buffer_, kBufferSize, &bytes_read)) {
+ while (request->Read(buffer_.get(), kBufferSize, &bytes_read)) {
if (bytes_read > 0) {
data_consumed = ConsumeResponseData(bytes_read);
if (!data_consumed)
@@ -226,7 +226,7 @@ void AppCacheUpdateJob::URLFetcher::ReadResponseData() {
if (state == CACHE_FAILURE || state == CANCELLED || state == COMPLETED)
return;
int bytes_read = 0;
- request_->Read(buffer_, kBufferSize, &bytes_read);
+ request_->Read(buffer_.get(), kBufferSize, &bytes_read);
OnReadCompleted(request_.get(), bytes_read);
}
@@ -244,7 +244,7 @@ bool AppCacheUpdateJob::URLFetcher::ConsumeResponseData(int bytes_read) {
case MASTER_ENTRY_FETCH:
DCHECK(response_writer_.get());
response_writer_->WriteData(
- buffer_, bytes_read,
+ buffer_.get(), bytes_read,
base::Bind(&URLFetcher::OnWriteComplete, base::Unretained(this)));
return false; // wait for async write completion to continue reading
default:
@@ -311,7 +311,7 @@ AppCacheUpdateJob::~AppCacheUpdateJob() {
DCHECK(!manifest_fetcher_);
DCHECK(pending_url_fetches_.empty());
- DCHECK(!inprogress_cache_);
+ DCHECK(!inprogress_cache_.get());
DCHECK(pending_master_entries_.empty());
DCHECK(master_entry_fetches_.empty());
@@ -425,7 +425,7 @@ void AppCacheUpdateJob::FetchManifest(bool is_first_fetch) {
DCHECK(internal_state_ == REFETCH_MANIFEST);
DCHECK(manifest_response_info_.get());
manifest_fetcher_->set_existing_response_headers(
- manifest_response_info_->headers);
+ manifest_response_info_->headers.get());
manifest_fetcher_->Start();
}
}
@@ -519,7 +519,8 @@ void AppCacheUpdateJob::ContinueHandleManifestFetchCompleted(bool changed) {
PendingHosts& hosts = it->second;
for (PendingHosts::iterator host_it = hosts.begin();
host_it != hosts.end(); ++host_it) {
- (*host_it)->AssociateIncompleteCache(inprogress_cache_, manifest_url_);
+ (*host_it)->
+ AssociateIncompleteCache(inprogress_cache_.get(), manifest_url_);
}
}
@@ -622,7 +623,7 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(
// Section 6.9.4. No update case: step 7.3, else step 22.
if (response_code / 100 == 2) {
// Add fetched master entry to the appropriate cache.
- AppCache* cache = inprogress_cache_ ? inprogress_cache_.get() :
+ AppCache* cache = inprogress_cache_.get() ? inprogress_cache_.get() :
group_->newest_complete_cache();
DCHECK(fetcher->response_writer());
AppCacheEntry master_entry(AppCacheEntry::MASTER,
@@ -634,7 +635,7 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(
duplicate_response_ids_.push_back(master_entry.response_id());
// In no-update case, associate host with the newest cache.
- if (!inprogress_cache_) {
+ if (!inprogress_cache_.get()) {
// TODO(michaeln): defer until the updated cache has been stored
DCHECK(cache == group_->newest_complete_cache());
for (PendingHosts::iterator host_it = hosts.begin();
@@ -650,7 +651,7 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(
host_notifier.AddHost(host);
// In downloading case, disassociate host from inprogress cache.
- if (inprogress_cache_)
+ if (inprogress_cache_.get())
host->AssociateNoCache(GURL());
host->RemoveObserver(this);
@@ -664,7 +665,7 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(
// In downloading case, update result is different if all master entries
// failed vs. only some failing.
- if (inprogress_cache_) {
+ if (inprogress_cache_.get()) {
// Only count successful downloads to know if all master entries failed.
pending_master_entries_.erase(found);
--master_entries_completed_;
@@ -703,7 +704,7 @@ void AppCacheUpdateJob::HandleManifestRefetchCompleted(
scoped_refptr<HttpResponseInfoIOBuffer> io_buffer(
new HttpResponseInfoIOBuffer(manifest_response_info_.release()));
manifest_response_writer_->WriteInfo(
- io_buffer,
+ io_buffer.get(),
base::Bind(&AppCacheUpdateJob::OnManifestInfoWriteComplete,
base::Unretained(this)));
}
@@ -721,7 +722,7 @@ void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) {
scoped_refptr<net::StringIOBuffer> io_buffer(
new net::StringIOBuffer(manifest_data_));
manifest_response_writer_->WriteData(
- io_buffer, manifest_data_.length(),
+ io_buffer.get(), manifest_data_.length(),
base::Bind(&AppCacheUpdateJob::OnManifestDataWriteComplete,
base::Unretained(this)));
} else {
@@ -746,7 +747,7 @@ void AppCacheUpdateJob::StoreGroupAndCache() {
DCHECK(stored_state_ == UNSTORED);
stored_state_ = STORING;
scoped_refptr<AppCache> newest_cache;
- if (inprogress_cache_)
+ if (inprogress_cache_.get())
newest_cache.swap(inprogress_cache_);
else
newest_cache = group_->newest_complete_cache();
@@ -754,7 +755,7 @@ void AppCacheUpdateJob::StoreGroupAndCache() {
// TODO(michaeln): dcheck is fishing for clues to crbug/95101
DCHECK_EQ(manifest_url_, group_->manifest_url());
- service_->storage()->StoreGroupAndNewestCache(group_, newest_cache,
+ service_->storage()->StoreGroupAndNewestCache(group_, newest_cache.get(),
this); // async
}
@@ -814,7 +815,7 @@ void AppCacheUpdateJob::AddAllAssociatedHostsToNotifier(
// Collect hosts so we only send one notification per frontend.
// A host can only be associated with a single cache so no need to worry
// about duplicate hosts being added to the notifier.
- if (inprogress_cache_) {
+ if (inprogress_cache_.get()) {
DCHECK(internal_state_ == DOWNLOADING || internal_state_ == CACHE_FAILURE);
host_notifier->AddHosts(inprogress_cache_->associated_hosts());
}
@@ -861,7 +862,7 @@ void AppCacheUpdateJob::CheckIfManifestChanged() {
entry->response_id()));
read_manifest_buffer_ = new net::IOBuffer(kBufferSize);
manifest_response_reader_->ReadData(
- read_manifest_buffer_, kBufferSize,
+ read_manifest_buffer_.get(), kBufferSize,
base::Bind(&AppCacheUpdateJob::OnManifestDataReadComplete,
base::Unretained(this))); // async read
}
@@ -870,7 +871,7 @@ void AppCacheUpdateJob::OnManifestDataReadComplete(int result) {
if (result > 0) {
loaded_manifest_data_.append(read_manifest_buffer_->data(), result);
manifest_response_reader_->ReadData(
- read_manifest_buffer_, kBufferSize,
+ read_manifest_buffer_.get(), kBufferSize,
base::Bind(&AppCacheUpdateJob::OnManifestDataReadComplete,
base::Unretained(this))); // read more
} else {
@@ -959,7 +960,8 @@ void AppCacheUpdateJob::FetchUrls() {
DCHECK(existing_entry->response_id() ==
url_to_fetch.existing_response_info->response_id());
fetcher->set_existing_response_headers(
- url_to_fetch.existing_response_info->http_response_info()->headers);
+ url_to_fetch.existing_response_info->http_response_info()->
+ headers.get());
fetcher->set_existing_entry(*existing_entry);
}
fetcher->Start();
@@ -997,7 +999,7 @@ bool AppCacheUpdateJob::ShouldSkipUrlFetch(const AppCacheEntry& entry) {
bool AppCacheUpdateJob::AlreadyFetchedEntry(const GURL& url,
int entry_type) {
DCHECK(internal_state_ == DOWNLOADING || internal_state_ == NO_UPDATE);
- AppCacheEntry* existing = inprogress_cache_ ?
+ AppCacheEntry* existing = inprogress_cache_.get() ?
inprogress_cache_->GetEntry(url) :
group_->newest_complete_cache()->GetEntry(url);
if (existing) {
@@ -1014,9 +1016,9 @@ void AppCacheUpdateJob::AddMasterEntryToFetchList(AppCacheHost* host,
if (internal_state_ == DOWNLOADING || internal_state_ == NO_UPDATE) {
AppCache* cache;
- if (inprogress_cache_) {
+ if (inprogress_cache_.get()) {
// always associate
- host->AssociateIncompleteCache(inprogress_cache_, manifest_url_);
+ host->AssociateIncompleteCache(inprogress_cache_.get(), manifest_url_);
cache = inprogress_cache_.get();
} else {
cache = group_->newest_complete_cache();
@@ -1026,7 +1028,7 @@ void AppCacheUpdateJob::AddMasterEntryToFetchList(AppCacheHost* host,
AppCacheEntry* entry = cache->GetEntry(url);
if (entry) {
entry->add_types(AppCacheEntry::MASTER);
- if (internal_state_ == NO_UPDATE && !inprogress_cache_) {
+ if (internal_state_ == NO_UPDATE && !inprogress_cache_.get()) {
// only associate if have entry
host->AssociateCompleteCache(cache);
}
@@ -1149,7 +1151,8 @@ void AppCacheUpdateJob::OnResponseInfoLoaded(
// Needed response info for a manifest fetch request.
if (internal_state_ == FETCH_MANIFEST) {
if (http_info)
- manifest_fetcher_->set_existing_response_headers(http_info->headers);
+ manifest_fetcher_->
+ set_existing_response_headers(http_info->headers.get());
manifest_fetcher_->Start();
return;
}
@@ -1166,7 +1169,7 @@ void AppCacheUpdateJob::OnResponseInfoLoaded(
const std::string name = "vary";
std::string value;
void* iter = NULL;
- if (!http_info->headers ||
+ if (!http_info->headers.get() ||
http_info->headers->RequiresValidation(http_info->request_time,
http_info->response_time,
base::Time::Now()) ||
@@ -1310,7 +1313,7 @@ void AppCacheUpdateJob::ClearPendingMasterEntries() {
void AppCacheUpdateJob::DiscardInprogressCache() {
service_->storage()->DoomResponses(manifest_url_, stored_response_ids_);
- if (!inprogress_cache_) {
+ if (!inprogress_cache_.get()) {
// We have to undo the changes we made, if any, to the existing cache.
for (std::vector<GURL>::iterator iter = added_master_entries_.begin();
iter != added_master_entries_.end(); ++iter) {
« no previous file with comments | « webkit/appcache/appcache_unittest.cc ('k') | webkit/appcache/appcache_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698