Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "net/base/cache_type.h" | 11 #include "net/base/cache_type.h" |
| 11 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
| 12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 static const base::FilePath::CharType kGpuCachePath[] = | 19 static const base::FilePath::CharType kGpuCachePath[] = |
| 19 FILE_PATH_LITERAL("GPUCache"); | 20 FILE_PATH_LITERAL("GPUCache"); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 if (!iter->second.empty()) { | 496 if (!iter->second.empty()) { |
| 496 iter->second.front()->Clear(); | 497 iter->second.front()->Clear(); |
| 497 return; | 498 return; |
| 498 } | 499 } |
| 499 | 500 |
| 500 shader_clear_map_.erase(path); | 501 shader_clear_map_.erase(path); |
| 501 } | 502 } |
| 502 | 503 |
| 503 ShaderDiskCache::ShaderDiskCache(const base::FilePath& cache_path) | 504 ShaderDiskCache::ShaderDiskCache(const base::FilePath& cache_path) |
| 504 : cache_available_(false), | 505 : cache_available_(false), |
| 505 max_cache_size_(0), | 506 max_cache_size_(gpu::kDefaultMaxProgramCacheMemoryBytes), |
|
pasko
2013/06/17 16:47:37
The field is used only once, directly feeding the
dsinclair
2013/06/17 18:59:11
Done.
| |
| 506 host_id_(0), | 507 host_id_(0), |
| 507 cache_path_(cache_path), | 508 cache_path_(cache_path), |
| 508 is_initialized_(false), | 509 is_initialized_(false), |
| 509 backend_(NULL) { | 510 backend_(NULL) { |
| 510 ShaderCacheFactory::GetInstance()->AddToCache(cache_path_, this); | 511 ShaderCacheFactory::GetInstance()->AddToCache(cache_path_, this); |
| 511 } | 512 } |
| 512 | 513 |
| 513 ShaderDiskCache::~ShaderDiskCache() { | 514 ShaderDiskCache::~ShaderDiskCache() { |
| 514 ShaderCacheFactory::GetInstance()->RemoveFromCache(cache_path_); | 515 ShaderCacheFactory::GetInstance()->RemoveFromCache(cache_path_); |
| 515 if (backend_) | 516 if (backend_) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 609 const net::CompletionCallback& callback) { | 610 const net::CompletionCallback& callback) { |
| 610 if (entry_map_.empty()) { | 611 if (entry_map_.empty()) { |
| 611 return net::OK; | 612 return net::OK; |
| 612 } | 613 } |
| 613 cache_complete_callback_ = callback; | 614 cache_complete_callback_ = callback; |
| 614 return net::ERR_IO_PENDING; | 615 return net::ERR_IO_PENDING; |
| 615 } | 616 } |
| 616 | 617 |
| 617 } // namespace content | 618 } // namespace content |
| 618 | 619 |
| OLD | NEW |