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

Side by Side Diff: cc/output/output_surface.cc

Issue 638353002: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formating. 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 18 matching lines...) Expand all
29 #include "ui/gfx/geometry/size.h" 29 #include "ui/gfx/geometry/size.h"
30 30
31 using std::set; 31 using std::set;
32 using std::string; 32 using std::string;
33 using std::vector; 33 using std::vector;
34 34
35 namespace cc { 35 namespace cc {
36 36
37 OutputSurface::OutputSurface( 37 OutputSurface::OutputSurface(
38 const scoped_refptr<ContextProvider>& context_provider) 38 const scoped_refptr<ContextProvider>& context_provider)
39 : client_(NULL), 39 : client_(nullptr),
40 context_provider_(context_provider), 40 context_provider_(context_provider),
41 device_scale_factor_(-1), 41 device_scale_factor_(-1),
42 external_stencil_test_enabled_(false), 42 external_stencil_test_enabled_(false),
43 weak_ptr_factory_(this) { 43 weak_ptr_factory_(this) {
44 } 44 }
45 45
46 OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device) 46 OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device)
47 : client_(NULL), 47 : client_(nullptr),
48 software_device_(software_device.Pass()), 48 software_device_(software_device.Pass()),
49 device_scale_factor_(-1), 49 device_scale_factor_(-1),
50 external_stencil_test_enabled_(false), 50 external_stencil_test_enabled_(false),
51 weak_ptr_factory_(this) { 51 weak_ptr_factory_(this) {
52 } 52 }
53 53
54 OutputSurface::OutputSurface( 54 OutputSurface::OutputSurface(
55 const scoped_refptr<ContextProvider>& context_provider, 55 const scoped_refptr<ContextProvider>& context_provider,
56 scoped_ptr<SoftwareOutputDevice> software_device) 56 scoped_ptr<SoftwareOutputDevice> software_device)
57 : client_(NULL), 57 : client_(nullptr),
58 context_provider_(context_provider), 58 context_provider_(context_provider),
59 software_device_(software_device.Pass()), 59 software_device_(software_device.Pass()),
60 device_scale_factor_(-1), 60 device_scale_factor_(-1),
61 external_stencil_test_enabled_(false), 61 external_stencil_test_enabled_(false),
62 weak_ptr_factory_(this) { 62 weak_ptr_factory_(this) {
63 } 63 }
64 64
65 void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase, 65 void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase,
66 base::TimeDelta interval) { 66 base::TimeDelta interval) {
67 TRACE_EVENT2("cc", 67 TRACE_EVENT2("cc",
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 client_ = client; 120 client_ = client;
121 bool success = true; 121 bool success = true;
122 122
123 if (context_provider_.get()) { 123 if (context_provider_.get()) {
124 success = context_provider_->BindToCurrentThread(); 124 success = context_provider_->BindToCurrentThread();
125 if (success) 125 if (success)
126 SetUpContext3d(); 126 SetUpContext3d();
127 } 127 }
128 128
129 if (!success) 129 if (!success)
130 client_ = NULL; 130 client_ = nullptr;
131 131
132 return success; 132 return success;
133 } 133 }
134 134
135 bool OutputSurface::InitializeAndSetContext3d( 135 bool OutputSurface::InitializeAndSetContext3d(
136 scoped_refptr<ContextProvider> context_provider) { 136 scoped_refptr<ContextProvider> context_provider) {
137 DCHECK(!context_provider_.get()); 137 DCHECK(!context_provider_.get());
138 DCHECK(context_provider.get()); 138 DCHECK(context_provider.get());
139 DCHECK(client_); 139 DCHECK(client_);
140 140
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ResetContext3d(); 177 ResetContext3d();
178 } 178 }
179 179
180 void OutputSurface::ResetContext3d() { 180 void OutputSurface::ResetContext3d() {
181 if (context_provider_.get()) { 181 if (context_provider_.get()) {
182 context_provider_->SetLostContextCallback( 182 context_provider_->SetLostContextCallback(
183 ContextProvider::LostContextCallback()); 183 ContextProvider::LostContextCallback());
184 context_provider_->SetMemoryPolicyChangedCallback( 184 context_provider_->SetMemoryPolicyChangedCallback(
185 ContextProvider::MemoryPolicyChangedCallback()); 185 ContextProvider::MemoryPolicyChangedCallback());
186 } 186 }
187 context_provider_ = NULL; 187 context_provider_ = nullptr;
188 } 188 }
189 189
190 void OutputSurface::EnsureBackbuffer() { 190 void OutputSurface::EnsureBackbuffer() {
191 if (software_device_) 191 if (software_device_)
192 software_device_->EnsureBackbuffer(); 192 software_device_->EnsureBackbuffer();
193 } 193 }
194 194
195 void OutputSurface::DiscardBackbuffer() { 195 void OutputSurface::DiscardBackbuffer() {
196 if (context_provider_.get()) 196 if (context_provider_.get())
197 context_provider_->ContextGL()->DiscardBackbufferCHROMIUM(); 197 context_provider_->ContextGL()->DiscardBackbufferCHROMIUM();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", 268 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy",
269 "bytes_limit_when_visible", policy.bytes_limit_when_visible); 269 "bytes_limit_when_visible", policy.bytes_limit_when_visible);
270 // Just ignore the memory manager when it says to set the limit to zero 270 // Just ignore the memory manager when it says to set the limit to zero
271 // bytes. This will happen when the memory manager thinks that the renderer 271 // bytes. This will happen when the memory manager thinks that the renderer
272 // is not visible (which the renderer knows better). 272 // is not visible (which the renderer knows better).
273 if (policy.bytes_limit_when_visible) 273 if (policy.bytes_limit_when_visible)
274 client_->SetMemoryPolicy(policy); 274 client_->SetMemoryPolicy(policy);
275 } 275 }
276 276
277 } // namespace cc 277 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698