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( |