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

Unified Diff: content/browser/gpu/shader_disk_cache.cc

Issue 588243002: Reland of "Remove void** from disk_cache interface" w/ blockfile iter fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1-webcacheimpl
Patch Set: cleanup presubmit Created 6 years, 3 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 | « no previous file | content/browser/service_worker/service_worker_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/shader_disk_cache.cc
diff --git a/content/browser/gpu/shader_disk_cache.cc b/content/browser/gpu/shader_disk_cache.cc
index a7f240ce565b8e49ebd4b7c55c87f56db84b1fbb..c97fd9e9922a272771df6c1b560dd596176e27bb 100644
--- a/content/browser/gpu/shader_disk_cache.cc
+++ b/content/browser/gpu/shader_disk_cache.cc
@@ -23,6 +23,9 @@ void EntryCloser(disk_cache::Entry* entry) {
entry->Close();
}
+void FreeDiskCacheIterator(scoped_ptr<disk_cache::Backend::Iterator> iterator) {
+}
+
} // namespace
// ShaderDiskCacheEntry handles the work of caching/updating the cached
@@ -95,7 +98,7 @@ class ShaderDiskReadHelper
base::WeakPtr<ShaderDiskCache> cache_;
OpType op_type_;
- void* iter_;
+ scoped_ptr<disk_cache::Backend::Iterator> iter_;
scoped_refptr<net::IOBufferWithSize> buf_;
int host_id_;
disk_cache::Entry* entry_;
@@ -243,7 +246,6 @@ ShaderDiskReadHelper::ShaderDiskReadHelper(
int host_id)
: cache_(cache),
op_type_(OPEN_NEXT),
- iter_(NULL),
buf_(NULL),
host_id_(host_id),
entry_(NULL) {
@@ -291,16 +293,17 @@ int ShaderDiskReadHelper::OpenNextEntry() {
DCHECK(CalledOnValidThread());
// Called through OnOpComplete, so we know |cache_| is valid.
op_type_ = OPEN_NEXT_COMPLETE;
- return cache_->backend()->OpenNextEntry(
- &iter_,
- &entry_,
- base::Bind(&ShaderDiskReadHelper::OnOpComplete, this));
+ if (!iter_)
+ iter_ = cache_->backend()->CreateIterator();
+ return iter_->OpenNextEntry(
+ &entry_, base::Bind(&ShaderDiskReadHelper::OnOpComplete, this));
}
int ShaderDiskReadHelper::OpenNextEntryComplete(int rv) {
DCHECK(CalledOnValidThread());
// Called through OnOpComplete, so we know |cache_| is valid.
if (rv == net::ERR_FAILED) {
+ iter_.reset();
op_type_ = ITERATION_FINISHED;
return net::OK;
}
@@ -339,16 +342,21 @@ int ShaderDiskReadHelper::ReadComplete(int rv) {
int ShaderDiskReadHelper::IterationComplete(int rv) {
DCHECK(CalledOnValidThread());
// Called through OnOpComplete, so we know |cache_| is valid.
- cache_->backend()->EndEnumeration(&iter_);
- iter_ = NULL;
+ iter_.reset();
op_type_ = TERMINATE;
return net::OK;
}
ShaderDiskReadHelper::~ShaderDiskReadHelper() {
- if (entry_)
+ if (entry_) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&EntryCloser, entry_));
+ }
+ if (iter_) {
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(&FreeDiskCacheIterator,
+ base::Passed(&iter_)));
+ }
}
ShaderClearHelper::ShaderClearHelper(scoped_refptr<ShaderDiskCache> cache,
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698