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 |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 // Background stubs 1 and 2, and they should fit. All stubs should | 917 // Background stubs 1 and 2, and they should fit. All stubs should |
918 // have their full nicetohave budget should they become visible. | 918 // have their full nicetohave budget should they become visible. |
919 stub2.SetVisible(false); | 919 stub2.SetVisible(false); |
920 stub1.SetVisible(false); | 920 stub1.SetVisible(false); |
921 Manage(); | 921 Manage(); |
922 EXPECT_GE(stub1.BytesWhenVisible(), 23u); | 922 EXPECT_GE(stub1.BytesWhenVisible(), 23u); |
923 EXPECT_GE(stub2.BytesWhenVisible(), 23u); | 923 EXPECT_GE(stub2.BytesWhenVisible(), 23u); |
924 EXPECT_GE(stub3.BytesWhenVisible(), 23u); | 924 EXPECT_GE(stub3.BytesWhenVisible(), 23u); |
925 EXPECT_LT(stub1.BytesWhenVisible(), 32u); | 925 EXPECT_LT(stub1.BytesWhenVisible(), 32u); |
926 EXPECT_LT(stub2.BytesWhenVisible(), 32u); | 926 EXPECT_LT(stub2.BytesWhenVisible(), 32u); |
927 EXPECT_LT(stub3.BytesWhenVisible(), 32u); | |
928 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u); | 927 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u); |
929 EXPECT_GE(stub2.BytesWhenNotVisible(), 6u); | 928 EXPECT_GE(stub2.BytesWhenNotVisible(), 6u); |
930 EXPECT_GE(stub3.BytesWhenNotVisible(), 6u); | 929 EXPECT_GE(stub3.BytesWhenNotVisible(), 6u); |
931 | 930 |
932 // Now background stub 3, and it should cause stub 2 to be | 931 // Now background stub 3, and it should cause stub 2 to be |
933 // evicted because it was set non-visible first | 932 // evicted because it was set non-visible first |
934 stub3.SetVisible(false); | 933 stub3.SetVisible(false); |
935 Manage(); | 934 Manage(); |
936 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u); | 935 EXPECT_GE(stub1.BytesWhenNotVisible(), 6u); |
937 EXPECT_EQ(stub2.BytesWhenNotVisible(), 0u); | 936 EXPECT_EQ(stub2.BytesWhenNotVisible(), 0u); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 TEST_F(GpuMemoryManagerTestNonuniform, DefaultAllocation) { | 1033 TEST_F(GpuMemoryManagerTestNonuniform, DefaultAllocation) { |
1035 // Set memory manager constants for this test | 1034 // Set memory manager constants for this test |
1036 memmgr_.TestingSetUseNonuniformMemoryPolicy(true); | 1035 memmgr_.TestingSetUseNonuniformMemoryPolicy(true); |
1037 memmgr_.TestingSetAvailableGpuMemory(64); | 1036 memmgr_.TestingSetAvailableGpuMemory(64); |
1038 memmgr_.TestingSetNonvisibleAvailableGpuMemory(16); | 1037 memmgr_.TestingSetNonvisibleAvailableGpuMemory(16); |
1039 memmgr_.TestingSetMinimumClientAllocation(8); | 1038 memmgr_.TestingSetMinimumClientAllocation(8); |
1040 memmgr_.TestingSetDefaultClientAllocation(16); | 1039 memmgr_.TestingSetDefaultClientAllocation(16); |
1041 | 1040 |
1042 FakeClient stub1(&memmgr_, GenerateUniqueSurfaceId(), true); | 1041 FakeClient stub1(&memmgr_, GenerateUniqueSurfaceId(), true); |
1043 | 1042 |
1044 // Expect that a client which has not sent stats receive the | 1043 // Expect that a client which has not sent stats receive at |
1045 // default allocation. | 1044 // least the default allocation. |
1046 Manage(); | 1045 Manage(); |
1047 EXPECT_EQ(stub1.BytesWhenVisible(), | 1046 EXPECT_GE(stub1.BytesWhenVisible(), |
1048 memmgr_.GetDefaultClientAllocation()); | 1047 memmgr_.GetDefaultClientAllocation()); |
1049 EXPECT_EQ(stub1.BytesWhenNotVisible(), 0u); | 1048 EXPECT_EQ(stub1.BytesWhenNotVisible(), 0u); |
1050 } | 1049 } |
1051 | 1050 |
1052 } // namespace content | 1051 } // namespace content |
OLD | NEW |