| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_buffer/service/memory_program_cache.h" | 5 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 14 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
| 15 #include "gpu/command_buffer/service/gpu_service_test.h" | 15 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 16 #include "gpu/command_buffer/service/progress_reporter_stub.h" |
| 16 #include "gpu/command_buffer/service/shader_manager.h" | 17 #include "gpu/command_buffer/service/shader_manager.h" |
| 17 #include "gpu/command_buffer/service/shader_translator.h" | 18 #include "gpu/command_buffer/service/shader_translator.h" |
| 18 #include "gpu/command_buffer/service/test_helper.h" | 19 #include "gpu/command_buffer/service/test_helper.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/gl/gl_bindings.h" | 21 #include "ui/gl/gl_bindings.h" |
| 21 #include "ui/gl/gl_mock.h" | 22 #include "ui/gl/gl_mock.h" |
| 22 | 23 |
| 23 using ::testing::_; | 24 using ::testing::_; |
| 24 using ::testing::Invoke; | 25 using ::testing::Invoke; |
| 25 using ::testing::SetArgPointee; | 26 using ::testing::SetArgPointee; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static const bool kDisableGpuDiskCache = false; | 73 static const bool kDisableGpuDiskCache = false; |
| 73 static const GLuint kVertexShaderClientId = 90; | 74 static const GLuint kVertexShaderClientId = 90; |
| 74 static const GLuint kVertexShaderServiceId = 100; | 75 static const GLuint kVertexShaderServiceId = 100; |
| 75 static const GLuint kFragmentShaderClientId = 91; | 76 static const GLuint kFragmentShaderClientId = 91; |
| 76 static const GLuint kFragmentShaderServiceId = 100; | 77 static const GLuint kFragmentShaderServiceId = 100; |
| 77 | 78 |
| 78 MemoryProgramCacheTest() | 79 MemoryProgramCacheTest() |
| 79 : cache_(new MemoryProgramCache(kCacheSizeBytes, kDisableGpuDiskCache)), | 80 : cache_(new MemoryProgramCache(kCacheSizeBytes, kDisableGpuDiskCache)), |
| 80 vertex_shader_(NULL), | 81 vertex_shader_(NULL), |
| 81 fragment_shader_(NULL), | 82 fragment_shader_(NULL), |
| 82 shader_cache_count_(0) { | 83 shader_cache_count_(0) {} |
| 84 ~MemoryProgramCacheTest() override { |
| 85 ProgressReporterStub progress_reporter; |
| 86 shader_manager_.Destroy(false, &progress_reporter); |
| 83 } | 87 } |
| 84 ~MemoryProgramCacheTest() override { shader_manager_.Destroy(false); } | |
| 85 | 88 |
| 86 void ShaderCacheCb(const std::string& key, const std::string& shader) { | 89 void ShaderCacheCb(const std::string& key, const std::string& shader) { |
| 87 shader_cache_count_++; | 90 shader_cache_count_++; |
| 88 shader_cache_shader_ = shader; | 91 shader_cache_shader_ = shader; |
| 89 } | 92 } |
| 90 | 93 |
| 91 int32_t shader_cache_count() { return shader_cache_count_; } | 94 int32_t shader_cache_count() { return shader_cache_count_; } |
| 92 const std::string& shader_cache_shader() { return shader_cache_shader_; } | 95 const std::string& shader_cache_shader() { return shader_cache_shader_; } |
| 93 | 96 |
| 94 protected: | 97 protected: |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 fragment_shader_, | 687 fragment_shader_, |
| 685 NULL, | 688 NULL, |
| 686 varyings_, | 689 varyings_, |
| 687 GL_NONE, | 690 GL_NONE, |
| 688 base::Bind(&MemoryProgramCacheTest::ShaderCacheCb, | 691 base::Bind(&MemoryProgramCacheTest::ShaderCacheCb, |
| 689 base::Unretained(this)))); | 692 base::Unretained(this)))); |
| 690 } | 693 } |
| 691 | 694 |
| 692 } // namespace gles2 | 695 } // namespace gles2 |
| 693 } // namespace gpu | 696 } // namespace gpu |
| OLD | NEW |