| 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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "gpu/command_buffer/service/error_state_mock.h" | 10 #include "gpu/command_buffer/service/error_state_mock.h" |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 GetLevelInfo(restored_texture.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0)); | 2160 GetLevelInfo(restored_texture.get(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0)); |
| 2161 } | 2161 } |
| 2162 | 2162 |
| 2163 class CountingMemoryTracker : public MemoryTracker { | 2163 class CountingMemoryTracker : public MemoryTracker { |
| 2164 public: | 2164 public: |
| 2165 CountingMemoryTracker() { | 2165 CountingMemoryTracker() { |
| 2166 current_size_[0] = 0; | 2166 current_size_[0] = 0; |
| 2167 current_size_[1] = 0; | 2167 current_size_[1] = 0; |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 virtual void TrackMemoryAllocatedChange(size_t old_size, | 2170 void TrackMemoryAllocatedChange(size_t old_size, |
| 2171 size_t new_size, | 2171 size_t new_size, |
| 2172 Pool pool) override { | 2172 Pool pool) override { |
| 2173 DCHECK_LT(static_cast<size_t>(pool), arraysize(current_size_)); | 2173 DCHECK_LT(static_cast<size_t>(pool), arraysize(current_size_)); |
| 2174 current_size_[pool] += new_size - old_size; | 2174 current_size_[pool] += new_size - old_size; |
| 2175 } | 2175 } |
| 2176 | 2176 |
| 2177 virtual bool EnsureGPUMemoryAvailable(size_t size_needed) override { | 2177 bool EnsureGPUMemoryAvailable(size_t size_needed) override { return true; } |
| 2178 return true; | |
| 2179 } | |
| 2180 | 2178 |
| 2181 size_t GetSize(Pool pool) { | 2179 size_t GetSize(Pool pool) { |
| 2182 DCHECK_LT(static_cast<size_t>(pool), arraysize(current_size_)); | 2180 DCHECK_LT(static_cast<size_t>(pool), arraysize(current_size_)); |
| 2183 return current_size_[pool]; | 2181 return current_size_[pool]; |
| 2184 } | 2182 } |
| 2185 | 2183 |
| 2186 private: | 2184 private: |
| 2187 virtual ~CountingMemoryTracker() {} | 2185 ~CountingMemoryTracker() override {} |
| 2188 | 2186 |
| 2189 size_t current_size_[2]; | 2187 size_t current_size_[2]; |
| 2190 DISALLOW_COPY_AND_ASSIGN(CountingMemoryTracker); | 2188 DISALLOW_COPY_AND_ASSIGN(CountingMemoryTracker); |
| 2191 }; | 2189 }; |
| 2192 | 2190 |
| 2193 class SharedTextureTest : public GpuServiceTest { | 2191 class SharedTextureTest : public GpuServiceTest { |
| 2194 public: | 2192 public: |
| 2195 static const bool kUseDefaultTextures = false; | 2193 static const bool kUseDefaultTextures = false; |
| 2196 | 2194 |
| 2197 SharedTextureTest() : feature_info_(new FeatureInfo()) {} | 2195 SharedTextureTest() : feature_info_(new FeatureInfo()) {} |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2500 | 2498 |
| 2501 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 2499 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
| 2502 .Times(1) | 2500 .Times(1) |
| 2503 .RetiresOnSaturation(); | 2501 .RetiresOnSaturation(); |
| 2504 texture_manager1_->RemoveTexture(10); | 2502 texture_manager1_->RemoveTexture(10); |
| 2505 texture_manager2_->RemoveTexture(20); | 2503 texture_manager2_->RemoveTexture(20); |
| 2506 } | 2504 } |
| 2507 | 2505 |
| 2508 } // namespace gles2 | 2506 } // namespace gles2 |
| 2509 } // namespace gpu | 2507 } // namespace gpu |
| OLD | NEW |