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

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

Issue 937263006: Refactored GLContext to own GPUTiming which spawn GPUTimingClients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added GPUTiming descriptions for all 3 classes, refptr in GPUTimer Created 5 years, 9 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/gpu_timing.h » ('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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
11 #include "ui/gl/gl_bindings.h" 11 #include "ui/gl/gl_bindings.h"
12 #include "ui/gl/gl_context.h" 12 #include "ui/gl/gl_context.h"
13 #include "ui/gl/gl_gl_api_implementation.h" 13 #include "ui/gl/gl_gl_api_implementation.h"
14 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
15 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
16 #include "ui/gl/gl_switches.h" 16 #include "ui/gl/gl_switches.h"
17 #include "ui/gl/gl_version_info.h" 17 #include "ui/gl/gl_version_info.h"
18 #include "ui/gl/gpu_timing.h"
18 19
19 namespace gfx { 20 namespace gfx {
20 21
21 namespace { 22 namespace {
22 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky 23 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky
23 current_context_ = LAZY_INSTANCE_INITIALIZER; 24 current_context_ = LAZY_INSTANCE_INITIALIZER;
24 25
25 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky 26 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky
26 current_real_context_ = LAZY_INSTANCE_INITIALIZER; 27 current_real_context_ = LAZY_INSTANCE_INITIALIZER;
27 } // namespace 28 } // namespace
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 virtual_gl_api_->OnReleaseVirtuallyCurrent(virtual_context); 206 virtual_gl_api_->OnReleaseVirtuallyCurrent(virtual_context);
206 } 207 }
207 208
208 void GLContext::SetRealGLApi() { 209 void GLContext::SetRealGLApi() {
209 SetGLToRealGLApi(); 210 SetGLToRealGLApi();
210 } 211 }
211 212
212 GLContextReal::GLContextReal(GLShareGroup* share_group) 213 GLContextReal::GLContextReal(GLShareGroup* share_group)
213 : GLContext(share_group) {} 214 : GLContext(share_group) {}
214 215
216 scoped_refptr<gfx::GPUTimingClient> GLContextReal::CreateGPUTimingClient() {
217 if (!gpu_timing_) {
218 gpu_timing_.reset(new gfx::GPUTiming(this));
219 }
220 return gpu_timing_->CreateGPUTimingClient();
221 }
222
215 GLContextReal::~GLContextReal() {} 223 GLContextReal::~GLContextReal() {}
216 224
217 void GLContextReal::SetCurrent(GLSurface* surface) { 225 void GLContextReal::SetCurrent(GLSurface* surface) {
218 GLContext::SetCurrent(surface); 226 GLContext::SetCurrent(surface);
219 current_real_context_.Pointer()->Set(surface ? this : NULL); 227 current_real_context_.Pointer()->Set(surface ? this : NULL);
220 } 228 }
221 229
222 } // namespace gfx 230 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gpu_timing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698