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

Side by Side Diff: content/browser/gpu/shader_disk_cache.cc

Issue 16256018: Update content/ to use WeakPtr<T>::get() instead of implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix incorrectly modified code Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/gpu/shader_disk_cache.h" 5 #include "content/browser/gpu/shader_disk_cache.h"
6 6
7 #include "base/threading/thread_checker.h" 7 #include "base/threading/thread_checker.h"
8 #include "content/browser/gpu/gpu_process_host.h" 8 #include "content/browser/gpu/gpu_process_host.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "net/base/cache_type.h" 10 #include "net/base/cache_type.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 ShaderDiskCacheEntry::~ShaderDiskCacheEntry() { 147 ShaderDiskCacheEntry::~ShaderDiskCacheEntry() {
148 if (entry_) 148 if (entry_)
149 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 149 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
150 base::Bind(&EntryCloser, entry_)); 150 base::Bind(&EntryCloser, entry_));
151 } 151 }
152 152
153 void ShaderDiskCacheEntry::Cache() { 153 void ShaderDiskCacheEntry::Cache() {
154 DCHECK(CalledOnValidThread()); 154 DCHECK(CalledOnValidThread());
155 if (!cache_) 155 if (!cache_.get())
156 return; 156 return;
157 157
158 int rv = cache_->backend()->OpenEntry( 158 int rv = cache_->backend()->OpenEntry(
159 key_, 159 key_,
160 &entry_, 160 &entry_,
161 base::Bind(&ShaderDiskCacheEntry::OnOpComplete, this)); 161 base::Bind(&ShaderDiskCacheEntry::OnOpComplete, this));
162 if (rv != net::ERR_IO_PENDING) 162 if (rv != net::ERR_IO_PENDING)
163 OnOpComplete(rv); 163 OnOpComplete(rv);
164 } 164 }
165 165
166 void ShaderDiskCacheEntry::OnOpComplete(int rv) { 166 void ShaderDiskCacheEntry::OnOpComplete(int rv) {
167 DCHECK(CalledOnValidThread()); 167 DCHECK(CalledOnValidThread());
168 if (!cache_) 168 if (!cache_.get())
169 return; 169 return;
170 170
171 do { 171 do {
172 switch (op_type_) { 172 switch (op_type_) {
173 case OPEN_ENTRY: 173 case OPEN_ENTRY:
174 rv = OpenCallback(rv); 174 rv = OpenCallback(rv);
175 break; 175 break;
176 case CREATE_ENTRY: 176 case CREATE_ENTRY:
177 rv = WriteCallback(rv); 177 rv = WriteCallback(rv);
178 break; 178 break;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 : cache_(cache), 241 : cache_(cache),
242 op_type_(OPEN_NEXT), 242 op_type_(OPEN_NEXT),
243 iter_(NULL), 243 iter_(NULL),
244 buf_(NULL), 244 buf_(NULL),
245 host_id_(host_id), 245 host_id_(host_id),
246 entry_(NULL) { 246 entry_(NULL) {
247 } 247 }
248 248
249 void ShaderDiskReadHelper::LoadCache() { 249 void ShaderDiskReadHelper::LoadCache() {
250 DCHECK(CalledOnValidThread()); 250 DCHECK(CalledOnValidThread());
251 if (!cache_) 251 if (!cache_.get())
252 return; 252 return;
253 OnOpComplete(net::OK); 253 OnOpComplete(net::OK);
254 } 254 }
255 255
256 void ShaderDiskReadHelper::OnOpComplete(int rv) { 256 void ShaderDiskReadHelper::OnOpComplete(int rv) {
257 DCHECK(CalledOnValidThread()); 257 DCHECK(CalledOnValidThread());
258 if (!cache_) 258 if (!cache_.get())
259 return; 259 return;
260 260
261 do { 261 do {
262 switch (op_type_) { 262 switch (op_type_) {
263 case OPEN_NEXT: 263 case OPEN_NEXT:
264 rv = OpenNextEntry(); 264 rv = OpenNextEntry();
265 break; 265 break;
266 case OPEN_NEXT_COMPLETE: 266 case OPEN_NEXT_COMPLETE:
267 rv = OpenNextEntryComplete(rv); 267 rv = OpenNextEntryComplete(rv);
268 break; 268 break;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 const net::CompletionCallback& callback) { 609 const net::CompletionCallback& callback) {
610 if (entry_map_.empty()) { 610 if (entry_map_.empty()) {
611 return net::OK; 611 return net::OK;
612 } 612 }
613 cache_complete_callback_ = callback; 613 cache_complete_callback_ = callback;
614 return net::ERR_IO_PENDING; 614 return net::ERR_IO_PENDING;
615 } 615 }
616 616
617 } // namespace content 617 } // namespace content
618 618
OLDNEW
« no previous file with comments | « content/browser/download/download_request_handle.cc ('k') | content/browser/plugin_loader_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698