| 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_manager.h" | 5 #include "content/common/gpu/gpu_memory_manager.h" |
| 6 #include "content/common/gpu/gpu_memory_manager_client.h" | 6 #include "content/common/gpu/gpu_memory_manager_client.h" |
| 7 #include "content/common/gpu/gpu_memory_tracking.h" | 7 #include "content/common/gpu/gpu_memory_tracking.h" |
| 8 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 8 #include "gpu/command_buffer/common/gpu_memory_allocation.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 using gpu::MemoryAllocation; | 13 using gpu::MemoryAllocation; |
| 14 | 14 |
| 15 #if defined(COMPILER_GCC) | |
| 16 namespace BASE_HASH_NAMESPACE { | |
| 17 template<> | |
| 18 struct hash<content::GpuMemoryManagerClient*> { | |
| 19 uint64 operator()(content::GpuMemoryManagerClient* ptr) const { | |
| 20 return hash<uint64>()(reinterpret_cast<uint64>(ptr)); | |
| 21 } | |
| 22 }; | |
| 23 } // namespace BASE_HASH_NAMESPACE | |
| 24 #endif // COMPILER | |
| 25 | |
| 26 class FakeMemoryTracker : public gpu::gles2::MemoryTracker { | 15 class FakeMemoryTracker : public gpu::gles2::MemoryTracker { |
| 27 public: | 16 public: |
| 28 virtual void TrackMemoryAllocatedChange( | 17 virtual void TrackMemoryAllocatedChange( |
| 29 size_t /* old_size */, | 18 size_t /* old_size */, |
| 30 size_t /* new_size */, | 19 size_t /* new_size */, |
| 31 gpu::gles2::MemoryTracker::Pool /* pool */) OVERRIDE { | 20 gpu::gles2::MemoryTracker::Pool /* pool */) OVERRIDE { |
| 32 } | 21 } |
| 33 virtual bool EnsureGPUMemoryAvailable(size_t /* size_needed */) OVERRIDE { | 22 virtual bool EnsureGPUMemoryAvailable(size_t /* size_needed */) OVERRIDE { |
| 34 return true; | 23 return true; |
| 35 } | 24 } |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 stub_ignore_c.SetVisible(true); | 399 stub_ignore_c.SetVisible(true); |
| 411 stub_ignore_c.SetVisible(false); | 400 stub_ignore_c.SetVisible(false); |
| 412 Manage(); | 401 Manage(); |
| 413 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub1.allocation_)); | 402 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub1.allocation_)); |
| 414 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub2.allocation_)); | 403 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub2.allocation_)); |
| 415 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub3.allocation_)); | 404 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub3.allocation_)); |
| 416 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub4.allocation_)); | 405 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub4.allocation_)); |
| 417 } | 406 } |
| 418 | 407 |
| 419 } // namespace content | 408 } // namespace content |
| OLD | NEW |