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

Unified Diff: content/browser/appcache/appcache_storage_impl.cc

Issue 2040833002: AppCache: Add nullptr check where AppCacheStorageImpl::disk_cache() is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ensure disk_cache_ Created 4 years, 6 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 | « content/browser/appcache/appcache_storage_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/appcache_storage_impl.cc
diff --git a/content/browser/appcache/appcache_storage_impl.cc b/content/browser/appcache/appcache_storage_impl.cc
index 96e5d1be2968a6f8ded15bac0d8454a5b3d7eaed..2159d159372e2884a36701f787416391d5f2a7d9 100644
--- a/content/browser/appcache/appcache_storage_impl.cc
+++ b/content/browser/appcache/appcache_storage_impl.cc
@@ -1735,19 +1735,20 @@ void AppCacheStorageImpl::StoreEvictionTimes(AppCacheGroup* group) {
AppCacheResponseReader* AppCacheStorageImpl::CreateResponseReader(
const GURL& manifest_url,
int64_t response_id) {
- return new AppCacheResponseReader(response_id, disk_cache()->GetWeakPtr());
+ return new AppCacheResponseReader(
+ response_id, is_disabled_ ? nullptr : disk_cache()->GetWeakPtr());
}
AppCacheResponseWriter* AppCacheStorageImpl::CreateResponseWriter(
const GURL& manifest_url) {
- return new AppCacheResponseWriter(NewResponseId(),
- disk_cache()->GetWeakPtr());
+ return new AppCacheResponseWriter(
+ NewResponseId(), is_disabled_ ? nullptr : disk_cache()->GetWeakPtr());
}
AppCacheResponseMetadataWriter*
AppCacheStorageImpl::CreateResponseMetadataWriter(int64_t response_id) {
- return new AppCacheResponseMetadataWriter(response_id,
- disk_cache()->GetWeakPtr());
+ return new AppCacheResponseMetadataWriter(
+ response_id, is_disabled_ ? nullptr : disk_cache()->GetWeakPtr());
}
void AppCacheStorageImpl::DoomResponses(
@@ -1812,8 +1813,7 @@ void AppCacheStorageImpl::DeleteOneResponse() {
DCHECK(is_response_deletion_scheduled_);
DCHECK(!deletable_response_ids_.empty());
- if (!disk_cache()) {
- DCHECK(is_disabled_);
+ if (is_disabled_) {
deletable_response_ids_.clear();
deleted_response_ids_.clear();
is_response_deletion_scheduled_ = false;
@@ -1822,7 +1822,7 @@ void AppCacheStorageImpl::DeleteOneResponse() {
// TODO(michaeln): add group_id to DoomEntry args
int64_t id = deletable_response_ids_.front();
- int rv = disk_cache_->DoomEntry(
+ int rv = disk_cache()->DoomEntry(
kinuko 2016/06/06 06:59:06 Actually I feel dcheck'ing disk_cache_ might be ju
nhiroki 2016/06/06 07:00:42 Acknowledged.
id, base::Bind(&AppCacheStorageImpl::OnDeletedOneResponse,
base::Unretained(this)));
if (rv != net::ERR_IO_PENDING)
@@ -1901,9 +1901,7 @@ void AppCacheStorageImpl::RunOnePendingSimpleTask() {
AppCacheDiskCache* AppCacheStorageImpl::disk_cache() {
DCHECK(IsInitTaskComplete());
-
- if (is_disabled_)
- return NULL;
+ DCHECK(!is_disabled_);
if (!disk_cache_) {
int rv = net::OK;
« no previous file with comments | « content/browser/appcache/appcache_storage_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698