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

Unified Diff: ui/gl/gl_implementation_win.cc

Issue 22744005: initialize trace_event hooks in angle on gpu startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: separate from angle Created 7 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_implementation_win.cc
diff --git a/ui/gl/gl_implementation_win.cc b/ui/gl/gl_implementation_win.cc
index c98c3c013143e111b2ccaca5709151cb2efc7680..6040b8e64aead208733fb719897995002c11b1d5 100644
--- a/ui/gl/gl_implementation_win.cc
+++ b/ui/gl/gl_implementation_win.cc
@@ -8,6 +8,7 @@
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/debug/trace_event.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/native_library.h"
@@ -58,6 +59,45 @@ bool LoadD3DXLibrary(const base::FilePath& module_path,
return true;
}
+const unsigned char* AngleGetTraceCategoryEnabledFlag(const char* name) {
+ return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name);
+}
+
+void AngleAddTraceEvent(char phase,
+ const unsigned char* category_group_enabled,
+ const char* name,
+ unsigned long long id,
+ int num_args,
+ const char** arg_names,
+ const unsigned char* arg_types,
+ const unsigned long long* arg_values,
+ unsigned char flags) {
+ TRACE_EVENT_API_ADD_TRACE_EVENT(phase,
+ category_group_enabled,
+ name,
+ id,
+ num_args,
+ arg_names,
+ arg_types,
+ arg_values,
+ NULL,
+ flags);
+}
+
+typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
+typedef void (*AddTraceEventFunc)(char phase,
+ const unsigned char* categoryGroupEnabled,
+ const char* name,
+ unsigned long long id,
+ int numArgs,
+ const char** argNames,
+ const unsigned char* argTypes,
+ const unsigned long long* argValues,
+ unsigned char flags);
+typedef void (*SetTraceFunctionPointersFunc)(
+ GetCategoryEnabledFlagFunc get_category_enabled_flag,
+ AddTraceEventFunc add_trace_event_func);
+
} // namespace
void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
@@ -167,6 +207,17 @@ bool InitializeGLBindings(GLImplementation implementation) {
}
#endif
+ if (!using_swift_shader) {
+ SetTraceFunctionPointersFunc set_trace_function_pointers =
+ reinterpret_cast<SetTraceFunctionPointersFunc>(
+ base::GetFunctionPointerFromNativeLibrary(
+ gles_library, "SetTraceFunctionPointers"));
+ if (set_trace_function_pointers) {
+ set_trace_function_pointers(&AngleGetTraceCategoryEnabledFlag,
+ &AngleAddTraceEvent);
+ }
+ }
+
GLGetProcAddressProc get_proc_address =
reinterpret_cast<GLGetProcAddressProc>(
base::GetFunctionPointerFromNativeLibrary(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698