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

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

Issue 649533003: C++11 declares a type safe null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Presubmit errors Created 6 years, 2 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
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_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
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 scoped_refptr<gpu::gles2::MemoryTracker> memory_tracker_; 80 scoped_refptr<gpu::gles2::MemoryTracker> memory_tracker_;
81 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; 81 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_;
82 scoped_ptr<GpuMemoryManagerClientState> client_state_; 82 scoped_ptr<GpuMemoryManagerClientState> client_state_;
83 83
84 // This will create a client with no surface 84 // This will create a client with no surface
85 FakeClient(GpuMemoryManager* memmgr, GpuMemoryManagerClient* share_group) 85 FakeClient(GpuMemoryManager* memmgr, GpuMemoryManagerClient* share_group)
86 : memmgr_(memmgr), 86 : memmgr_(memmgr),
87 suggest_have_frontbuffer_(false), 87 suggest_have_frontbuffer_(false),
88 total_gpu_memory_(0), 88 total_gpu_memory_(0),
89 share_group_(share_group), 89 share_group_(share_group),
90 memory_tracker_(NULL) { 90 memory_tracker_(nullptr) {
91 if (!share_group_) { 91 if (!share_group_) {
92 memory_tracker_ = new FakeMemoryTracker(); 92 memory_tracker_ = new FakeMemoryTracker();
93 tracking_group_.reset( 93 tracking_group_.reset(
94 memmgr_->CreateTrackingGroup(0, memory_tracker_.get())); 94 memmgr_->CreateTrackingGroup(0, memory_tracker_.get()));
95 } 95 }
96 client_state_.reset(memmgr_->CreateClientState(this, false, true)); 96 client_state_.reset(memmgr_->CreateClientState(this, false, true));
97 } 97 }
98 98
99 // This will create a client with a surface 99 // This will create a client with a surface
100 FakeClient(GpuMemoryManager* memmgr, int32 surface_id, bool visible) 100 FakeClient(GpuMemoryManager* memmgr, int32 surface_id, bool visible)
101 : memmgr_(memmgr), 101 : memmgr_(memmgr),
102 suggest_have_frontbuffer_(false), 102 suggest_have_frontbuffer_(false),
103 total_gpu_memory_(0), 103 total_gpu_memory_(0),
104 share_group_(NULL), 104 share_group_(nullptr),
105 memory_tracker_(NULL) { 105 memory_tracker_(nullptr) {
106 memory_tracker_ = new FakeMemoryTracker(); 106 memory_tracker_ = new FakeMemoryTracker();
107 tracking_group_.reset( 107 tracking_group_.reset(
108 memmgr_->CreateTrackingGroup(0, memory_tracker_.get())); 108 memmgr_->CreateTrackingGroup(0, memory_tracker_.get()));
109 client_state_.reset( 109 client_state_.reset(
110 memmgr_->CreateClientState(this, surface_id != 0, visible)); 110 memmgr_->CreateClientState(this, surface_id != 0, visible));
111 } 111 }
112 112
113 virtual ~FakeClient() { 113 virtual ~FakeClient() {
114 client_state_.reset(); 114 client_state_.reset();
115 tracking_group_.reset(); 115 tracking_group_.reset();
116 memory_tracker_ = NULL; 116 memory_tracker_ = nullptr;
117 } 117 }
118 118
119 virtual void SetMemoryAllocation(const MemoryAllocation& alloc) override { 119 virtual void SetMemoryAllocation(const MemoryAllocation& alloc) override {
120 allocation_ = alloc; 120 allocation_ = alloc;
121 ClientAssignmentCollector::AddClientStat(this, alloc); 121 ClientAssignmentCollector::AddClientStat(this, alloc);
122 } 122 }
123 123
124 virtual void SuggestHaveFrontBuffer(bool suggest_have_frontbuffer) override { 124 virtual void SuggestHaveFrontBuffer(bool suggest_have_frontbuffer) override {
125 suggest_have_frontbuffer_ = suggest_have_frontbuffer; 125 suggest_have_frontbuffer_ = suggest_have_frontbuffer;
126 } 126 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 stub_ignore_c.SetVisible(true); 410 stub_ignore_c.SetVisible(true);
411 stub_ignore_c.SetVisible(false); 411 stub_ignore_c.SetVisible(false);
412 Manage(); 412 Manage();
413 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub1.allocation_)); 413 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub1.allocation_));
414 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub2.allocation_)); 414 EXPECT_TRUE(IsAllocationHibernatedForSurfaceYes(stub2.allocation_));
415 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub3.allocation_)); 415 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub3.allocation_));
416 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub4.allocation_)); 416 EXPECT_TRUE(IsAllocationHibernatedForSurfaceNo(stub4.allocation_));
417 } 417 }
418 418
419 } // namespace content 419 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_x11.cc ('k') | content/common/gpu/gpu_surface_lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698