OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/win/event_trace_provider.h" | 5 #include "base/win/event_trace_provider.h" |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <cguid.h> | 7 #include <cguid.h> |
8 | 8 |
9 namespace base { | 9 namespace base { |
10 namespace win { | 10 namespace win { |
11 | 11 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 ULONG EtwTraceProvider::Register() { | 78 ULONG EtwTraceProvider::Register() { |
79 if (provider_name_ == GUID_NULL) | 79 if (provider_name_ == GUID_NULL) |
80 return ERROR_INVALID_NAME; | 80 return ERROR_INVALID_NAME; |
81 | 81 |
82 return ::RegisterTraceGuids(ControlCallback, this, &provider_name_, | 82 return ::RegisterTraceGuids(ControlCallback, this, &provider_name_, |
83 1, &obligatory_guid_registration_, NULL, NULL, ®istration_handle_); | 83 1, &obligatory_guid_registration_, NULL, NULL, ®istration_handle_); |
84 } | 84 } |
85 | 85 |
86 ULONG EtwTraceProvider::Unregister() { | 86 ULONG EtwTraceProvider::Unregister() { |
87 // If a session is active, notify subclasses that it's going away. | |
88 if (session_handle_ != NULL) | |
89 DisableEvents(); | |
robertshield
2012/03/09 16:58:04
if session_handle_ is null, the level and flags no
grt (UTC plus 2)
2012/03/09 17:55:25
I don't see a way for session_handle_ to be NULL a
| |
90 | |
87 ULONG ret = ::UnregisterTraceGuids(registration_handle_); | 91 ULONG ret = ::UnregisterTraceGuids(registration_handle_); |
88 | 92 |
89 // Make sure we don't log anything from here on. | |
90 enable_level_ = 0; | |
91 enable_flags_ = 0; | |
92 session_handle_ = NULL; | |
93 registration_handle_ = NULL; | 93 registration_handle_ = NULL; |
94 | 94 |
95 return ret; | 95 return ret; |
96 } | 96 } |
97 | 97 |
98 ULONG EtwTraceProvider::Log(const EtwEventClass& event_class, | 98 ULONG EtwTraceProvider::Log(const EtwEventClass& event_class, |
99 EtwEventType type, EtwEventLevel level, const char *message) { | 99 EtwEventType type, EtwEventLevel level, const char *message) { |
100 if (NULL == session_handle_ || enable_level_ < level) | 100 if (NULL == session_handle_ || enable_level_ < level) |
101 return ERROR_SUCCESS; // No one listening. | 101 return ERROR_SUCCESS; // No one listening. |
102 | 102 |
(...skipping 22 matching lines...) Expand all Loading... | |
125 | 125 |
126 ULONG EtwTraceProvider::Log(EVENT_TRACE_HEADER* event) { | 126 ULONG EtwTraceProvider::Log(EVENT_TRACE_HEADER* event) { |
127 if (enable_level_ < event->Class.Level) | 127 if (enable_level_ < event->Class.Level) |
128 return ERROR_SUCCESS; | 128 return ERROR_SUCCESS; |
129 | 129 |
130 return ::TraceEvent(session_handle_, event); | 130 return ::TraceEvent(session_handle_, event); |
131 } | 131 } |
132 | 132 |
133 } // namespace win | 133 } // namespace win |
134 } // namespace base | 134 } // namespace base |
OLD | NEW |