Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/common/gpu/gpu_memory_manager_unittest.cc

Issue 10274009: GpuMemoryManager should limit memory allocations based on viewport size for android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding const Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_memory_manager.cc ('k') | content/common/gpu/image_transport_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_command_buffer_stub.h" 5 #include "content/common/gpu/gpu_command_buffer_stub.h"
6 #include "content/common/gpu/gpu_memory_allocation.h" 6 #include "content/common/gpu/gpu_memory_allocation.h"
7 #include "content/common/gpu/gpu_memory_manager.h" 7 #include "content/common/gpu/gpu_memory_manager.h"
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 15 matching lines...) Expand all
26 virtual bool client_has_memory_allocation_changed_callback() const { 26 virtual bool client_has_memory_allocation_changed_callback() const {
27 return true; 27 return true;
28 } 28 }
29 virtual bool has_surface_state() const { 29 virtual bool has_surface_state() const {
30 return surface_state_.surface_id != 0; 30 return surface_state_.surface_id != 0;
31 } 31 }
32 virtual const SurfaceState& surface_state() const { 32 virtual const SurfaceState& surface_state() const {
33 return surface_state_; 33 return surface_state_;
34 } 34 }
35 35
36 virtual gfx::Size GetSurfaceSize() const {
37 return gfx::Size();
38 }
36 virtual bool IsInSameContextShareGroup( 39 virtual bool IsInSameContextShareGroup(
37 const GpuCommandBufferStubBase& stub) const { 40 const GpuCommandBufferStubBase& stub) const {
38 return false; 41 return false;
39 } 42 }
40 virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) { 43 virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) {
41 } 44 }
42 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { 45 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) {
43 allocation_ = alloc; 46 allocation_ = alloc;
44 } 47 }
45 }; 48 };
(...skipping 11 matching lines...) Expand all
57 } 60 }
58 virtual bool has_surface_state() const { 61 virtual bool has_surface_state() const {
59 return false; 62 return false;
60 } 63 }
61 virtual const SurfaceState& surface_state() const { 64 virtual const SurfaceState& surface_state() const {
62 NOTREACHED(); 65 NOTREACHED();
63 static SurfaceState* surface_state_; 66 static SurfaceState* surface_state_;
64 return *surface_state_; 67 return *surface_state_;
65 } 68 }
66 69
70 virtual gfx::Size GetSurfaceSize() const {
71 return gfx::Size();
72 }
67 virtual bool IsInSameContextShareGroup( 73 virtual bool IsInSameContextShareGroup(
68 const GpuCommandBufferStubBase& stub) const { 74 const GpuCommandBufferStubBase& stub) const {
69 return std::find(share_group_.begin(), 75 return std::find(share_group_.begin(),
70 share_group_.end(), 76 share_group_.end(),
71 &stub) != share_group_.end(); 77 &stub) != share_group_.end();
72 } 78 }
73 virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) { 79 virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) {
74 } 80 }
75 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { 81 virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) {
76 allocation_ = alloc; 82 allocation_ = alloc;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 EXPECT_NE(allocation, GpuMemoryAllocation(sz+1, buffer_allocation)); 560 EXPECT_NE(allocation, GpuMemoryAllocation(sz+1, buffer_allocation));
555 561
556 for(size_t k = 0; k != suggested_buffer_allocation_values.size(); ++k) { 562 for(size_t k = 0; k != suggested_buffer_allocation_values.size(); ++k) {
557 int buffer_allocation_other = suggested_buffer_allocation_values[k]; 563 int buffer_allocation_other = suggested_buffer_allocation_values[k];
558 if (buffer_allocation == buffer_allocation_other) continue; 564 if (buffer_allocation == buffer_allocation_other) continue;
559 EXPECT_NE(allocation, GpuMemoryAllocation(sz, buffer_allocation_other)); 565 EXPECT_NE(allocation, GpuMemoryAllocation(sz, buffer_allocation_other));
560 } 566 }
561 } 567 }
562 } 568 }
563 } 569 }
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_manager.cc ('k') | content/common/gpu/image_transport_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698