| 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 "gpu/ipc/host/shader_disk_cache.h" | 5 #include "gpu/ipc/host/shader_disk_cache.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 // Insert the helper in the map before calling Clear(), since it can lead to a | 490 // Insert the helper in the map before calling Clear(), since it can lead to a |
| 491 // call back into CacheCleared(). | 491 // call back into CacheCleared(). |
| 492 ShaderClearHelper* helper_ptr = helper.get(); | 492 ShaderClearHelper* helper_ptr = helper.get(); |
| 493 shader_clear_map_.insert( | 493 shader_clear_map_.insert( |
| 494 std::pair<base::FilePath, ShaderClearQueue>(path, ShaderClearQueue())); | 494 std::pair<base::FilePath, ShaderClearQueue>(path, ShaderClearQueue())); |
| 495 shader_clear_map_[path].push(std::move(helper)); | 495 shader_clear_map_[path].push(std::move(helper)); |
| 496 helper_ptr->Clear(); | 496 helper_ptr->Clear(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void ShaderCacheFactory::ClearByClientId(int32_t client_id, |
| 500 const base::Time& delete_begin, |
| 501 const base::Time& delete_end, |
| 502 const base::Closure& callback) { |
| 503 DCHECK(CalledOnValidThread()); |
| 504 ClientIdToPathMap::iterator iter = client_id_to_path_map_.find(client_id); |
| 505 if (iter == client_id_to_path_map_.end()) |
| 506 return; |
| 507 return ClearByPath(iter->second, delete_begin, delete_end, callback); |
| 508 } |
| 509 |
| 499 void ShaderCacheFactory::CacheCleared(const base::FilePath& path) { | 510 void ShaderCacheFactory::CacheCleared(const base::FilePath& path) { |
| 500 DCHECK(CalledOnValidThread()); | 511 DCHECK(CalledOnValidThread()); |
| 501 | 512 |
| 502 ShaderClearMap::iterator iter = shader_clear_map_.find(path); | 513 ShaderClearMap::iterator iter = shader_clear_map_.find(path); |
| 503 if (iter == shader_clear_map_.end()) { | 514 if (iter == shader_clear_map_.end()) { |
| 504 LOG(ERROR) << "Completed clear but missing clear helper."; | 515 LOG(ERROR) << "Completed clear but missing clear helper."; |
| 505 return; | 516 return; |
| 506 } | 517 } |
| 507 | 518 |
| 508 iter->second.pop(); | 519 iter->second.pop(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 int ShaderDiskCache::SetCacheCompleteCallback( | 631 int ShaderDiskCache::SetCacheCompleteCallback( |
| 621 const net::CompletionCallback& callback) { | 632 const net::CompletionCallback& callback) { |
| 622 if (entries_.empty()) { | 633 if (entries_.empty()) { |
| 623 return net::OK; | 634 return net::OK; |
| 624 } | 635 } |
| 625 cache_complete_callback_ = callback; | 636 cache_complete_callback_ = callback; |
| 626 return net::ERR_IO_PENDING; | 637 return net::ERR_IO_PENDING; |
| 627 } | 638 } |
| 628 | 639 |
| 629 } // namespace gpu | 640 } // namespace gpu |
| OLD | NEW |