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

Side by Side Diff: ui/gl/gl_context.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_context_cgl.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 "ui/gl/gl_context.h"
6
5 #include <string> 7 #include <string>
6 8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
11 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ptr_util.h"
12 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
13 #include "base/threading/thread_local.h" 16 #include "base/threading/thread_local.h"
14 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
15 #include "ui/gl/gl_context.h"
16 #include "ui/gl/gl_gl_api_implementation.h" 18 #include "ui/gl/gl_gl_api_implementation.h"
17 #include "ui/gl/gl_implementation.h" 19 #include "ui/gl/gl_implementation.h"
18 #include "ui/gl/gl_surface.h" 20 #include "ui/gl/gl_surface.h"
19 #include "ui/gl/gl_switches.h" 21 #include "ui/gl/gl_switches.h"
20 #include "ui/gl/gl_version_info.h" 22 #include "ui/gl/gl_version_info.h"
21 #include "ui/gl/gpu_timing.h" 23 #include "ui/gl/gpu_timing.h"
22 24
23 namespace gfx { 25 namespace gfx {
24 26
25 namespace { 27 namespace {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 std::string delimited_name(name); 123 std::string delimited_name(name);
122 delimited_name += " "; 124 delimited_name += " ";
123 125
124 return extensions.find(delimited_name) != std::string::npos; 126 return extensions.find(delimited_name) != std::string::npos;
125 } 127 }
126 128
127 const GLVersionInfo* GLContext::GetVersionInfo() { 129 const GLVersionInfo* GLContext::GetVersionInfo() {
128 if(!version_info_) { 130 if(!version_info_) {
129 std::string version = GetGLVersion(); 131 std::string version = GetGLVersion();
130 std::string renderer = GetGLRenderer(); 132 std::string renderer = GetGLRenderer();
131 version_info_ = 133 version_info_ = base::WrapUnique(new GLVersionInfo(
132 make_scoped_ptr(new GLVersionInfo( 134 version.c_str(), renderer.c_str(), GetExtensions().c_str()));
133 version.c_str(), renderer.c_str(),
134 GetExtensions().c_str()));
135 } 135 }
136 return version_info_.get(); 136 return version_info_.get();
137 } 137 }
138 138
139 GLShareGroup* GLContext::share_group() { 139 GLShareGroup* GLContext::share_group() {
140 return share_group_.get(); 140 return share_group_.get();
141 } 141 }
142 142
143 bool GLContext::LosesAllContextsOnContextLost() { 143 bool GLContext::LosesAllContextsOnContextLost() {
144 switch (GetGLImplementation()) { 144 switch (GetGLImplementation()) {
(...skipping 29 matching lines...) Expand all
174 if (!surface && GetGLImplementation() != kGLImplementationMockGL) { 174 if (!surface && GetGLImplementation() != kGLImplementationMockGL) {
175 SetGLApiToNoContext(); 175 SetGLApiToNoContext();
176 } 176 }
177 } 177 }
178 178
179 GLStateRestorer* GLContext::GetGLStateRestorer() { 179 GLStateRestorer* GLContext::GetGLStateRestorer() {
180 return state_restorer_.get(); 180 return state_restorer_.get();
181 } 181 }
182 182
183 void GLContext::SetGLStateRestorer(GLStateRestorer* state_restorer) { 183 void GLContext::SetGLStateRestorer(GLStateRestorer* state_restorer) {
184 state_restorer_ = make_scoped_ptr(state_restorer); 184 state_restorer_ = base::WrapUnique(state_restorer);
185 } 185 }
186 186
187 void GLContext::SetSwapInterval(int interval) { 187 void GLContext::SetSwapInterval(int interval) {
188 swap_interval_ = interval; 188 swap_interval_ = interval;
189 OnSetSwapInterval(force_swap_interval_zero_ ? 0 : swap_interval_); 189 OnSetSwapInterval(force_swap_interval_zero_ ? 0 : swap_interval_);
190 } 190 }
191 191
192 void GLContext::ForceSwapIntervalZero(bool force) { 192 void GLContext::ForceSwapIntervalZero(bool force) {
193 force_swap_interval_zero_ = force; 193 force_swap_interval_zero_ = force;
194 OnSetSwapInterval(force_swap_interval_zero_ ? 0 : swap_interval_); 194 OnSetSwapInterval(force_swap_interval_zero_ ? 0 : swap_interval_);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 242
243 GLContextReal::~GLContextReal() {} 243 GLContextReal::~GLContextReal() {}
244 244
245 void GLContextReal::SetCurrent(GLSurface* surface) { 245 void GLContextReal::SetCurrent(GLSurface* surface) {
246 GLContext::SetCurrent(surface); 246 GLContext::SetCurrent(surface);
247 current_real_context_.Pointer()->Set(surface ? this : nullptr); 247 current_real_context_.Pointer()->Set(surface ? this : nullptr);
248 } 248 }
249 249
250 } // namespace gfx 250 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_context_cgl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698