| 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 "content/common/gpu/gpu_memory_allocation.h" | 5 #include "content/common/gpu/gpu_memory_allocation.h" |
| 6 #include "content/common/gpu/gpu_memory_manager.h" | 6 #include "content/common/gpu/gpu_memory_manager.h" |
| 7 #include "content/common/gpu/gpu_memory_manager_client.h" | 7 #include "content/common/gpu/gpu_memory_manager_client.h" |
| 8 #include "content/common/gpu/gpu_memory_tracking.h" | 8 #include "content/common/gpu/gpu_memory_tracking.h" |
| 9 #include "ui/gfx/size_conversions.h" | 9 #include "ui/gfx/size_conversions.h" |
| 10 | 10 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 #if defined(COMPILER_GCC) | 13 #if defined(COMPILER_GCC) |
| 14 namespace BASE_HASH_NAMESPACE { | 14 namespace BASE_HASH_NAMESPACE { |
| 15 template<> | 15 template<> |
| 16 struct hash<content::GpuMemoryManagerClient*> { | 16 struct hash<content::GpuMemoryManagerClient*> { |
| 17 size_t operator()(content::GpuMemoryManagerClient* ptr) const { | 17 size_t operator()(content::GpuMemoryManagerClient* ptr) const { |
| 18 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 18 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 19 } | 19 } |
| 20 }; | 20 }; |
| 21 } // namespace BASE_HASH_NAMESPACE | 21 } // namespace BASE_HASH_NAMESPACE |
| 22 #endif // COMPILER | 22 #endif // COMPILER |
| 23 | 23 |
| 24 class FakeMemoryTracker : public gpu::gles2::MemoryTracker { | 24 class FakeMemoryTracker : public gpu::gles2::MemoryTracker { |
| 25 public: | 25 public: |
| 26 void TrackMemoryAllocatedChange( | 26 virtual void TrackMemoryAllocatedChange( |
| 27 size_t old_size, | 27 size_t /* old_size */, |
| 28 size_t new_size, | 28 size_t /* new_size */, |
| 29 gpu::gles2::MemoryTracker::Pool pool) { | 29 gpu::gles2::MemoryTracker::Pool /* pool */) { |
| 30 } |
| 31 virtual bool EnsureGPUMemoryAvailable(size_t /* size_needed */) { |
| 32 return true; |
| 30 } | 33 } |
| 31 private: | 34 private: |
| 32 ~FakeMemoryTracker() { | 35 ~FakeMemoryTracker() { |
| 33 } | 36 } |
| 34 }; | 37 }; |
| 35 | 38 |
| 36 namespace content { | 39 namespace content { |
| 37 | 40 |
| 38 // This class is used to collect all stub assignments during a | 41 // This class is used to collect all stub assignments during a |
| 39 // Manage() call. | 42 // Manage() call. |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 | 867 |
| 865 // Delete all tracked memory so we don't hit leak checks. | 868 // Delete all tracked memory so we don't hit leak checks. |
| 866 memmgr_.TrackMemoryAllocatedChange( | 869 memmgr_.TrackMemoryAllocatedChange( |
| 867 stub1.tracking_group_.get(), | 870 stub1.tracking_group_.get(), |
| 868 999, | 871 999, |
| 869 0, | 872 0, |
| 870 gpu::gles2::MemoryTracker::kUnmanaged); | 873 gpu::gles2::MemoryTracker::kUnmanaged); |
| 871 } | 874 } |
| 872 | 875 |
| 873 } // namespace content | 876 } // namespace content |
| OLD | NEW |