| 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/macros.h" |
| 8 #include "base/threading/thread_checker.h" | 8 #include "base/threading/thread_checker.h" |
| 9 #include "content/browser/gpu/gpu_process_host.h" | 9 #include "content/browser/gpu/gpu_process_host.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "gpu/command_buffer/common/constants.h" | 11 #include "gpu/command_buffer/common/constants.h" |
| 12 #include "net/base/cache_type.h" | 12 #include "net/base/cache_type.h" |
| 13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 static const base::FilePath::CharType kGpuCachePath[] = | 20 static const base::FilePath::CharType kGpuCachePath[] = |
| 21 FILE_PATH_LITERAL("GPUCache"); | 21 FILE_PATH_LITERAL("GPUCache"); |
| 22 | 22 |
| 23 void EntryCloser(disk_cache::Entry* entry) { | 23 void EntryCloser(disk_cache::Entry* entry) { |
| 24 entry->Close(); | 24 entry->Close(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void FreeDiskCacheIterator(scoped_ptr<disk_cache::Backend::Iterator> iterator) { | 27 void FreeDiskCacheIterator( |
| 28 } | 28 std::unique_ptr<disk_cache::Backend::Iterator> iterator) {} |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 // ShaderDiskCacheEntry handles the work of caching/updating the cached | 32 // ShaderDiskCacheEntry handles the work of caching/updating the cached |
| 33 // shaders. | 33 // shaders. |
| 34 class ShaderDiskCacheEntry | 34 class ShaderDiskCacheEntry |
| 35 : public base::ThreadChecker, | 35 : public base::ThreadChecker, |
| 36 public base::RefCounted<ShaderDiskCacheEntry> { | 36 public base::RefCounted<ShaderDiskCacheEntry> { |
| 37 public: | 37 public: |
| 38 ShaderDiskCacheEntry(base::WeakPtr<ShaderDiskCache> cache, | 38 ShaderDiskCacheEntry(base::WeakPtr<ShaderDiskCache> cache, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 void OnOpComplete(int rv); | 93 void OnOpComplete(int rv); |
| 94 | 94 |
| 95 int OpenNextEntry(); | 95 int OpenNextEntry(); |
| 96 int OpenNextEntryComplete(int rv); | 96 int OpenNextEntryComplete(int rv); |
| 97 int ReadComplete(int rv); | 97 int ReadComplete(int rv); |
| 98 int IterationComplete(int rv); | 98 int IterationComplete(int rv); |
| 99 | 99 |
| 100 base::WeakPtr<ShaderDiskCache> cache_; | 100 base::WeakPtr<ShaderDiskCache> cache_; |
| 101 OpType op_type_; | 101 OpType op_type_; |
| 102 scoped_ptr<disk_cache::Backend::Iterator> iter_; | 102 std::unique_ptr<disk_cache::Backend::Iterator> iter_; |
| 103 scoped_refptr<net::IOBufferWithSize> buf_; | 103 scoped_refptr<net::IOBufferWithSize> buf_; |
| 104 int host_id_; | 104 int host_id_; |
| 105 disk_cache::Entry* entry_; | 105 disk_cache::Entry* entry_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(ShaderDiskReadHelper); | 107 DISALLOW_COPY_AND_ASSIGN(ShaderDiskReadHelper); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 class ShaderClearHelper | 110 class ShaderClearHelper |
| 111 : public base::RefCounted<ShaderClearHelper>, | 111 : public base::RefCounted<ShaderClearHelper>, |
| 112 public base::SupportsWeakPtr<ShaderClearHelper> { | 112 public base::SupportsWeakPtr<ShaderClearHelper> { |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 const net::CompletionCallback& callback) { | 617 const net::CompletionCallback& callback) { |
| 618 if (entry_map_.empty()) { | 618 if (entry_map_.empty()) { |
| 619 return net::OK; | 619 return net::OK; |
| 620 } | 620 } |
| 621 cache_complete_callback_ = callback; | 621 cache_complete_callback_ = callback; |
| 622 return net::ERR_IO_PENDING; | 622 return net::ERR_IO_PENDING; |
| 623 } | 623 } |
| 624 | 624 |
| 625 } // namespace content | 625 } // namespace content |
| 626 | 626 |
| OLD | NEW |