OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Implementation of a Windows event trace controller class. | 5 // Implementation of a Windows event trace controller class. |
6 #include "base/event_trace_controller_win.h" | 6 #include "base/event_trace_controller_win.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 EtwTraceController::EtwTraceController() : session_(NULL) { | 9 EtwTraceController::EtwTraceController() : session_(NULL) { |
10 } | 10 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ULONG error = ::ControlTrace(session_, NULL, properties->get(), | 90 ULONG error = ::ControlTrace(session_, NULL, properties->get(), |
91 EVENT_TRACE_CONTROL_FLUSH); | 91 EVENT_TRACE_CONTROL_FLUSH); |
92 if (ERROR_SUCCESS != error) | 92 if (ERROR_SUCCESS != error) |
93 return HRESULT_FROM_WIN32(error); | 93 return HRESULT_FROM_WIN32(error); |
94 | 94 |
95 return S_OK; | 95 return S_OK; |
96 } | 96 } |
97 | 97 |
98 HRESULT EtwTraceController::Start(const wchar_t* session_name, | 98 HRESULT EtwTraceController::Start(const wchar_t* session_name, |
99 EtwTraceProperties* properties, TRACEHANDLE* session_handle) { | 99 EtwTraceProperties* properties, TRACEHANDLE* session_handle) { |
| 100 DCHECK(properties != NULL); |
100 ULONG err = ::StartTrace(session_handle, session_name, properties->get()); | 101 ULONG err = ::StartTrace(session_handle, session_name, properties->get()); |
101 return HRESULT_FROM_WIN32(err); | 102 return HRESULT_FROM_WIN32(err); |
102 } | 103 } |
103 | 104 |
104 HRESULT EtwTraceController::Query(const wchar_t* session_name, | 105 HRESULT EtwTraceController::Query(const wchar_t* session_name, |
105 EtwTraceProperties* properties) { | 106 EtwTraceProperties* properties) { |
106 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), | 107 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), |
107 EVENT_TRACE_CONTROL_QUERY); | 108 EVENT_TRACE_CONTROL_QUERY); |
108 return HRESULT_FROM_WIN32(err); | 109 return HRESULT_FROM_WIN32(err); |
109 }; | 110 }; |
110 | 111 |
111 HRESULT EtwTraceController::Update(const wchar_t* session_name, | 112 HRESULT EtwTraceController::Update(const wchar_t* session_name, |
112 EtwTraceProperties* properties) { | 113 EtwTraceProperties* properties) { |
| 114 DCHECK(properties != NULL); |
113 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), | 115 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), |
114 EVENT_TRACE_CONTROL_UPDATE); | 116 EVENT_TRACE_CONTROL_UPDATE); |
115 return HRESULT_FROM_WIN32(err); | 117 return HRESULT_FROM_WIN32(err); |
116 } | 118 } |
117 | 119 |
118 HRESULT EtwTraceController::Stop(const wchar_t* session_name, | 120 HRESULT EtwTraceController::Stop(const wchar_t* session_name, |
119 EtwTraceProperties* properties) { | 121 EtwTraceProperties* properties) { |
| 122 DCHECK(properties != NULL); |
120 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), | 123 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), |
121 EVENT_TRACE_CONTROL_STOP); | 124 EVENT_TRACE_CONTROL_STOP); |
122 return HRESULT_FROM_WIN32(err); | 125 return HRESULT_FROM_WIN32(err); |
123 } | 126 } |
124 | 127 |
125 HRESULT EtwTraceController::Flush(const wchar_t* session_name, | 128 HRESULT EtwTraceController::Flush(const wchar_t* session_name, |
126 EtwTraceProperties* properties) { | 129 EtwTraceProperties* properties) { |
| 130 DCHECK(properties != NULL); |
127 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), | 131 ULONG err = ::ControlTrace(NULL, session_name, properties->get(), |
128 EVENT_TRACE_CONTROL_FLUSH); | 132 EVENT_TRACE_CONTROL_FLUSH); |
129 return HRESULT_FROM_WIN32(err); | 133 return HRESULT_FROM_WIN32(err); |
130 } | 134 } |
OLD | NEW |