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

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

Issue 16911005: Fixing flaky ExtensionBrowsingDataTest.BrowsingDataRemovalMask test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 base::WeakPtr<ShaderDiskCache> cache_; 96 base::WeakPtr<ShaderDiskCache> cache_;
97 OpType op_type_; 97 OpType op_type_;
98 void* iter_; 98 void* iter_;
99 scoped_refptr<net::IOBufferWithSize> buf_; 99 scoped_refptr<net::IOBufferWithSize> buf_;
100 int host_id_; 100 int host_id_;
101 disk_cache::Entry* entry_; 101 disk_cache::Entry* entry_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(ShaderDiskReadHelper); 103 DISALLOW_COPY_AND_ASSIGN(ShaderDiskReadHelper);
104 }; 104 };
105 105
106 class ShaderClearHelper : public base::RefCounted<ShaderClearHelper> { 106 class ShaderClearHelper
107 : public base::RefCounted<ShaderClearHelper>,
108 public base::SupportsWeakPtr<ShaderClearHelper> {
107 public: 109 public:
108 ShaderClearHelper(scoped_refptr<ShaderDiskCache> cache, 110 ShaderClearHelper(scoped_refptr<ShaderDiskCache> cache,
109 const base::FilePath& path, 111 const base::FilePath& path,
110 const base::Time& delete_begin, 112 const base::Time& delete_begin,
111 const base::Time& delete_end, 113 const base::Time& delete_end,
112 const base::Closure& callback); 114 const base::Closure& callback);
113 void Clear(); 115 void Clear();
114 116
115 private: 117 private:
116 friend class base::RefCounted<ShaderClearHelper>; 118 friend class base::RefCounted<ShaderClearHelper>;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
376 378
377 // Hold a ref to ourselves so when we do the CacheCleared call we don't get 379 // Hold a ref to ourselves so when we do the CacheCleared call we don't get
378 // auto-deleted when our ref count drops to zero. 380 // auto-deleted when our ref count drops to zero.
379 scoped_refptr<ShaderClearHelper> helper = this; 381 scoped_refptr<ShaderClearHelper> helper = this;
380 382
381 while (rv != net::ERR_IO_PENDING) { 383 while (rv != net::ERR_IO_PENDING) {
382 switch (op_type_) { 384 switch (op_type_) {
383 case VERIFY_CACHE_SETUP: 385 case VERIFY_CACHE_SETUP:
384 rv = cache_->SetAvailableCallback( 386 rv = cache_->SetAvailableCallback(
385 base::Bind(&ShaderClearHelper::DoClearShaderCache, this)); 387 base::Bind(&ShaderClearHelper::DoClearShaderCache, AsWeakPtr()));
386 op_type_ = DELETE_CACHE; 388 op_type_ = DELETE_CACHE;
387 break; 389 break;
388 case DELETE_CACHE: 390 case DELETE_CACHE:
389 rv = cache_->Clear( 391 rv = cache_->Clear(
390 delete_begin_, delete_end_, 392 delete_begin_, delete_end_,
391 base::Bind(&ShaderClearHelper::DoClearShaderCache, this)); 393 base::Bind(&ShaderClearHelper::DoClearShaderCache, AsWeakPtr()));
392 op_type_ = TERMINATE; 394 op_type_ = TERMINATE;
393 break; 395 break;
394 case TERMINATE: 396 case TERMINATE:
395 ShaderCacheFactory::GetInstance()->CacheCleared(path_); 397 ShaderCacheFactory::GetInstance()->CacheCleared(path_);
396 callback_.Run(); 398 callback_.Run();
397 rv = net::ERR_IO_PENDING; // Break the loop. 399 rv = net::ERR_IO_PENDING; // Break the loop.
398 break; 400 break;
399 default: 401 default:
400 NOTREACHED(); // Invalid state provided. 402 NOTREACHED(); // Invalid state provided.
401 op_type_ = TERMINATE; 403 op_type_ = TERMINATE;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 const net::CompletionCallback& callback) { 611 const net::CompletionCallback& callback) {
610 if (entry_map_.empty()) { 612 if (entry_map_.empty()) {
611 return net::OK; 613 return net::OK;
612 } 614 }
613 cache_complete_callback_ = callback; 615 cache_complete_callback_ = callback;
614 return net::ERR_IO_PENDING; 616 return net::ERR_IO_PENDING;
615 } 617 }
616 618
617 } // namespace content 619 } // namespace content
618 620
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698