| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Declaration of a Windows event trace provider class, to allow using | 5 // Declaration of a Windows event trace provider class, to allow using |
| 6 // Windows Event Tracing for logging transport and control. | 6 // Windows Event Tracing for logging transport and control. |
| 7 #ifndef BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 7 #ifndef BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
| 8 #define BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 8 #define BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 #include <wmistr.h> | 11 #include <wmistr.h> |
| 12 #include <evntrace.h> | 12 #include <evntrace.h> |
| 13 #include <stdint.h> |
| 14 |
| 15 #include <limits> |
| 13 | 16 |
| 14 #include "base/base_export.h" | 17 #include "base/base_export.h" |
| 15 #include "base/basictypes.h" | 18 #include "base/macros.h" |
| 16 | 19 |
| 17 namespace base { | 20 namespace base { |
| 18 namespace win { | 21 namespace win { |
| 19 | 22 |
| 20 typedef GUID EtwEventClass; | 23 typedef GUID EtwEventClass; |
| 21 typedef UCHAR EtwEventType; | 24 typedef UCHAR EtwEventType; |
| 22 typedef UCHAR EtwEventLevel; | 25 typedef UCHAR EtwEventLevel; |
| 23 typedef USHORT EtwEventVersion; | 26 typedef USHORT EtwEventVersion; |
| 24 typedef ULONG EtwEventFlags; | 27 typedef ULONG EtwEventFlags; |
| 25 | 28 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 header.Size = sizeof(Super); | 62 header.Size = sizeof(Super); |
| 60 header.Guid = event_class; | 63 header.Guid = event_class; |
| 61 header.Class.Type = type; | 64 header.Class.Type = type; |
| 62 header.Class.Version = version; | 65 header.Class.Version = version; |
| 63 header.Class.Level = level; | 66 header.Class.Level = level; |
| 64 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; | 67 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; |
| 65 } | 68 } |
| 66 | 69 |
| 67 void SetField(int field, size_t size, const void *data) { | 70 void SetField(int field, size_t size, const void *data) { |
| 68 // DCHECK(field < N); | 71 // DCHECK(field < N); |
| 69 if ((field < N) && (size <= kuint32max)) { | 72 if ((field < N) && (size <= std::numeric_limits<uint32_t>::max())) { |
| 70 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); | 73 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); |
| 71 fields[field].Length = static_cast<ULONG>(size); | 74 fields[field].Length = static_cast<ULONG>(size); |
| 72 } | 75 } |
| 73 } | 76 } |
| 74 | 77 |
| 75 EVENT_TRACE_HEADER* get() { return& header; } | 78 EVENT_TRACE_HEADER* get() { return& header; } |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 DISALLOW_COPY_AND_ASSIGN(EtwMofEvent); | 81 DISALLOW_COPY_AND_ASSIGN(EtwMofEvent); |
| 79 }; | 82 }; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // RegisterTraceGuids. Non-const, because that's how the API needs it. | 174 // RegisterTraceGuids. Non-const, because that's how the API needs it. |
| 172 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; | 175 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; |
| 173 | 176 |
| 174 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); | 177 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); |
| 175 }; | 178 }; |
| 176 | 179 |
| 177 } // namespace win | 180 } // namespace win |
| 178 } // namespace base | 181 } // namespace base |
| 179 | 182 |
| 180 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ | 183 #endif // BASE_WIN_EVENT_TRACE_PROVIDER_H_ |
| OLD | NEW |