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 "gpu/command_buffer/common/constants.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 return; | 500 return; |
501 } | 501 } |
502 | 502 |
503 shader_clear_map_.erase(path); | 503 shader_clear_map_.erase(path); |
504 } | 504 } |
505 | 505 |
506 ShaderDiskCache::ShaderDiskCache(const base::FilePath& cache_path) | 506 ShaderDiskCache::ShaderDiskCache(const base::FilePath& cache_path) |
507 : cache_available_(false), | 507 : cache_available_(false), |
508 host_id_(0), | 508 host_id_(0), |
509 cache_path_(cache_path), | 509 cache_path_(cache_path), |
510 is_initialized_(false), | 510 is_initialized_(false) { |
511 backend_(NULL) { | |
512 ShaderCacheFactory::GetInstance()->AddToCache(cache_path_, this); | 511 ShaderCacheFactory::GetInstance()->AddToCache(cache_path_, this); |
513 } | 512 } |
514 | 513 |
515 ShaderDiskCache::~ShaderDiskCache() { | 514 ShaderDiskCache::~ShaderDiskCache() { |
516 ShaderCacheFactory::GetInstance()->RemoveFromCache(cache_path_); | 515 ShaderCacheFactory::GetInstance()->RemoveFromCache(cache_path_); |
517 if (backend_) | |
518 delete backend_; | |
519 } | 516 } |
520 | 517 |
521 void ShaderDiskCache::Init() { | 518 void ShaderDiskCache::Init() { |
522 if (is_initialized_) { | 519 if (is_initialized_) { |
523 NOTREACHED(); // can't initialize disk cache twice. | 520 NOTREACHED(); // can't initialize disk cache twice. |
524 return; | 521 return; |
525 } | 522 } |
526 is_initialized_ = true; | 523 is_initialized_ = true; |
527 | 524 |
528 int rv = disk_cache::CreateCacheBackend( | 525 int rv = disk_cache::CreateCacheBackend( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 const net::CompletionCallback& callback) { | 608 const net::CompletionCallback& callback) { |
612 if (entry_map_.empty()) { | 609 if (entry_map_.empty()) { |
613 return net::OK; | 610 return net::OK; |
614 } | 611 } |
615 cache_complete_callback_ = callback; | 612 cache_complete_callback_ = callback; |
616 return net::ERR_IO_PENDING; | 613 return net::ERR_IO_PENDING; |
617 } | 614 } |
618 | 615 |
619 } // namespace content | 616 } // namespace content |
620 | 617 |
OLD | NEW |