OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/trace_event/trace_event_etw_export_win.h" | 5 #include "base/trace_event/trace_event_etw_export_win.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "base/trace_event/trace_event_impl.h" | 12 #include "base/trace_event/trace_event_impl.h" |
13 | 13 |
14 // The GetProcAddress technique is borrowed from | 14 // The GetProcAddress technique is borrowed from |
15 // https://github.com/randomascii/main/tree/master/xperf/ETWProviders | 15 // https://github.com/google/UIforETW/tree/master/ETWProviders |
16 // | 16 // |
17 // EVNTAPI is used in evntprov.h which is included by chrome_events_win.h. | 17 // EVNTAPI is used in evntprov.h which is included by chrome_events_win.h. |
18 // We define EVNTAPI without the DECLSPEC_IMPORT specifier so that we can | 18 // We define EVNTAPI without the DECLSPEC_IMPORT specifier so that we can |
19 // implement these functions locally instead of using the import library, and | 19 // implement these functions locally instead of using the import library, and |
20 // can therefore still run on Windows XP. | 20 // can therefore still run on Windows XP. |
21 #define EVNTAPI __stdcall | 21 #define EVNTAPI __stdcall |
22 // Include the event register/write/unregister macros compiled from the manifest | 22 // Include the event register/write/unregister macros compiled from the manifest |
23 // file. Note that this includes evntprov.h which requires a Vista+ Windows SDK. | 23 // file. Note that this includes evntprov.h which requires a Vista+ Windows SDK. |
24 // | 24 // |
25 // In SHARED_INTERMEDIATE_DIR. | 25 // In SHARED_INTERMEDIATE_DIR. |
(...skipping 18 matching lines...) Expand all Loading... | |
44 | 44 |
45 // Redirector function for EventRegister. Called by macros in | 45 // Redirector function for EventRegister. Called by macros in |
46 // chrome_events_win.h | 46 // chrome_events_win.h |
47 ULONG EVNTAPI EventRegister(LPCGUID ProviderId, | 47 ULONG EVNTAPI EventRegister(LPCGUID ProviderId, |
48 PENABLECALLBACK EnableCallback, | 48 PENABLECALLBACK EnableCallback, |
49 PVOID CallbackContext, | 49 PVOID CallbackContext, |
50 PREGHANDLE RegHandle) { | 50 PREGHANDLE RegHandle) { |
51 if (EventRegisterProc) | 51 if (EventRegisterProc) |
52 return EventRegisterProc(ProviderId, EnableCallback, CallbackContext, | 52 return EventRegisterProc(ProviderId, EnableCallback, CallbackContext, |
53 RegHandle); | 53 RegHandle); |
54 *RegHandle = 0; | |
dsinclair
2015/05/19 15:39:37
Does chromium still use 0 or is nullptr acceptable
| |
54 return 0; | 55 return 0; |
55 } | 56 } |
56 | 57 |
57 // Redirector function for EventWrite. Called by macros in | 58 // Redirector function for EventWrite. Called by macros in |
58 // chrome_events_win.h | 59 // chrome_events_win.h |
59 ULONG EVNTAPI EventWrite(REGHANDLE RegHandle, | 60 ULONG EVNTAPI EventWrite(REGHANDLE RegHandle, |
60 PCEVENT_DESCRIPTOR EventDescriptor, | 61 PCEVENT_DESCRIPTOR EventDescriptor, |
61 ULONG UserDataCount, | 62 ULONG UserDataCount, |
62 PEVENT_DATA_DESCRIPTOR UserData) { | 63 PEVENT_DATA_DESCRIPTOR UserData) { |
63 if (EventWriteProc) | 64 if (EventWriteProc) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 EventWriteChromeEvent(name, phase, arg_name_1, arg_value_1, arg_name_2, | 231 EventWriteChromeEvent(name, phase, arg_name_1, arg_value_1, arg_name_2, |
231 arg_value_2, arg_name_3, arg_value_3); | 232 arg_value_2, arg_name_3, arg_value_3); |
232 } | 233 } |
233 | 234 |
234 void TraceEventETWExport::Resurrect() { | 235 void TraceEventETWExport::Resurrect() { |
235 StaticMemorySingletonTraits<TraceEventETWExport>::Resurrect(); | 236 StaticMemorySingletonTraits<TraceEventETWExport>::Resurrect(); |
236 } | 237 } |
237 | 238 |
238 } // namespace trace_event | 239 } // namespace trace_event |
239 } // namespace base | 240 } // namespace base |
OLD | NEW |