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

Unified Diff: ui/gl/gl_gl_api_implementation.cc

Issue 12207003: Add TRACE calls for all gpu driver calls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_gl_api_implementation.h ('k') | ui/gl/gl_glx_api_implementation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_gl_api_implementation.cc
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc
index 672f1ea47473ec8e1b1d43b922f9c0c68dda102b..303ae1d1f8aa4f82aba7497f8d72c62c616aef1f 100644
--- a/ui/gl/gl_gl_api_implementation.cc
+++ b/ui/gl/gl_gl_api_implementation.cc
@@ -7,21 +7,34 @@
#include <algorithm>
#include <vector>
+#include "base/command_line.h"
#include "base/string_util.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_state_restorer.h"
#include "ui/gl/gl_surface.h"
+#include "ui/gl/gl_switches.h"
namespace gfx {
-RealGLApi* g_real_gl;
+// The GL Api being used. This could be g_real_gl or gl_trace_gl
+static GLApi* g_gl;
+// A GL Api that calls directly into the driver.
+static RealGLApi* g_real_gl;
+// A GL Api that calls TRACE and then calls another GL api.
+static TraceGLApi* g_trace_gl;
void InitializeGLBindingsGL() {
g_driver_gl.InitializeBindings();
if (!g_real_gl) {
g_real_gl = new RealGLApi();
+ g_trace_gl = new TraceGLApi(g_real_gl);
}
g_real_gl->Initialize(&g_driver_gl);
+ g_gl = g_real_gl;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableGPUServiceTracing)) {
+ g_gl = g_trace_gl;
+ }
SetGLToRealGLApi();
}
@@ -34,7 +47,7 @@ void SetGLApi(GLApi* api) {
}
void SetGLToRealGLApi() {
- SetGLApi(g_real_gl);
+ SetGLApi(g_gl);
}
void InitializeGLExtensionBindingsGL(GLContext* context) {
@@ -50,6 +63,11 @@ void ClearGLBindingsGL() {
delete g_real_gl;
g_real_gl = NULL;
}
+ if (g_trace_gl) {
+ delete g_trace_gl;
+ g_trace_gl = NULL;
+ }
+ g_gl = NULL;
g_current_gl_context = NULL;
g_driver_gl.ClearBindings();
}
@@ -81,6 +99,9 @@ void RealGLApi::Initialize(DriverGL* driver) {
InitializeBase(driver);
}
+TraceGLApi::~TraceGLApi() {
+}
+
VirtualGLApi::VirtualGLApi()
: real_context_(NULL),
current_context_(NULL) {
« no previous file with comments | « ui/gl/gl_gl_api_implementation.h ('k') | ui/gl/gl_glx_api_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698