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

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: 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..04b5dd75daed729d244ec9f75626eef81d4c3882 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_) {
kinuko 2016/06/06 04:06:17 nit: !disk_cache() and is_disabled_ seems to have
nhiroki 2016/06/06 04:41:35 disk_cache() returns nullptr only if is_disabled_
kinuko 2016/06/06 04:56:21 It seems to mean disk_cache() has side-effect, is
nhiroki 2016/06/06 06:04:17 Ohh, good point! I'm not 100% sure that disk_cache
deletable_response_ids_.clear();
deleted_response_ids_.clear();
is_response_deletion_scheduled_ = false;
@@ -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