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/macros.h" |
7 #include "base/threading/thread_checker.h" | 8 #include "base/threading/thread_checker.h" |
8 #include "content/browser/gpu/gpu_process_host.h" | 9 #include "content/browser/gpu/gpu_process_host.h" |
9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
10 #include "gpu/command_buffer/common/constants.h" | 11 #include "gpu/command_buffer/common/constants.h" |
11 #include "net/base/cache_type.h" | 12 #include "net/base/cache_type.h" |
12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 return base::Singleton<ShaderCacheFactory, | 420 return base::Singleton<ShaderCacheFactory, |
420 base::LeakySingletonTraits<ShaderCacheFactory>>::get(); | 421 base::LeakySingletonTraits<ShaderCacheFactory>>::get(); |
421 } | 422 } |
422 | 423 |
423 ShaderCacheFactory::ShaderCacheFactory() { | 424 ShaderCacheFactory::ShaderCacheFactory() { |
424 } | 425 } |
425 | 426 |
426 ShaderCacheFactory::~ShaderCacheFactory() { | 427 ShaderCacheFactory::~ShaderCacheFactory() { |
427 } | 428 } |
428 | 429 |
429 void ShaderCacheFactory::SetCacheInfo(int32 client_id, | 430 void ShaderCacheFactory::SetCacheInfo(int32_t client_id, |
430 const base::FilePath& path) { | 431 const base::FilePath& path) { |
431 client_id_to_path_map_[client_id] = path; | 432 client_id_to_path_map_[client_id] = path; |
432 } | 433 } |
433 | 434 |
434 void ShaderCacheFactory::RemoveCacheInfo(int32 client_id) { | 435 void ShaderCacheFactory::RemoveCacheInfo(int32_t client_id) { |
435 client_id_to_path_map_.erase(client_id); | 436 client_id_to_path_map_.erase(client_id); |
436 } | 437 } |
437 | 438 |
438 scoped_refptr<ShaderDiskCache> ShaderCacheFactory::Get(int32 client_id) { | 439 scoped_refptr<ShaderDiskCache> ShaderCacheFactory::Get(int32_t client_id) { |
439 ClientIdToPathMap::iterator iter = | 440 ClientIdToPathMap::iterator iter = |
440 client_id_to_path_map_.find(client_id); | 441 client_id_to_path_map_.find(client_id); |
441 if (iter == client_id_to_path_map_.end()) | 442 if (iter == client_id_to_path_map_.end()) |
442 return NULL; | 443 return NULL; |
443 return ShaderCacheFactory::GetByPath(iter->second); | 444 return ShaderCacheFactory::GetByPath(iter->second); |
444 } | 445 } |
445 | 446 |
446 scoped_refptr<ShaderDiskCache> ShaderCacheFactory::GetByPath( | 447 scoped_refptr<ShaderDiskCache> ShaderCacheFactory::GetByPath( |
447 const base::FilePath& path) { | 448 const base::FilePath& path) { |
448 ShaderCacheMap::iterator iter = shader_cache_map_.find(path); | 449 ShaderCacheMap::iterator iter = shader_cache_map_.find(path); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 int rv; | 563 int rv; |
563 if (begin_time.is_null()) { | 564 if (begin_time.is_null()) { |
564 rv = backend_->DoomAllEntries(completion_callback); | 565 rv = backend_->DoomAllEntries(completion_callback); |
565 } else { | 566 } else { |
566 rv = backend_->DoomEntriesBetween(begin_time, end_time, | 567 rv = backend_->DoomEntriesBetween(begin_time, end_time, |
567 completion_callback); | 568 completion_callback); |
568 } | 569 } |
569 return rv; | 570 return rv; |
570 } | 571 } |
571 | 572 |
572 int32 ShaderDiskCache::Size() { | 573 int32_t ShaderDiskCache::Size() { |
573 if (!cache_available_) | 574 if (!cache_available_) |
574 return -1; | 575 return -1; |
575 return backend_->GetEntryCount(); | 576 return backend_->GetEntryCount(); |
576 } | 577 } |
577 | 578 |
578 int ShaderDiskCache::SetAvailableCallback( | 579 int ShaderDiskCache::SetAvailableCallback( |
579 const net::CompletionCallback& callback) { | 580 const net::CompletionCallback& callback) { |
580 if (cache_available_) | 581 if (cache_available_) |
581 return net::OK; | 582 return net::OK; |
582 available_callback_ = callback; | 583 available_callback_ = callback; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 const net::CompletionCallback& callback) { | 617 const net::CompletionCallback& callback) { |
617 if (entry_map_.empty()) { | 618 if (entry_map_.empty()) { |
618 return net::OK; | 619 return net::OK; |
619 } | 620 } |
620 cache_complete_callback_ = callback; | 621 cache_complete_callback_ = callback; |
621 return net::ERR_IO_PENDING; | 622 return net::ERR_IO_PENDING; |
622 } | 623 } |
623 | 624 |
624 } // namespace content | 625 } // namespace content |
625 | 626 |
OLD | NEW |