| 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 // 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_EVENT_TRACE_PROVIDER_WIN_H_ | 7 #ifndef BASE_EVENT_TRACE_PROVIDER_WIN_H_ |
| 8 #define BASE_EVENT_TRACE_PROVIDER_WIN_H_ | 8 #define BASE_EVENT_TRACE_PROVIDER_WIN_H_ |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 header.Size = sizeof(Super); | 49 header.Size = sizeof(Super); |
| 50 header.Guid = event_class; | 50 header.Guid = event_class; |
| 51 header.Class.Type = type; | 51 header.Class.Type = type; |
| 52 header.Class.Version = version; | 52 header.Class.Version = version; |
| 53 header.Class.Level = level; | 53 header.Class.Level = level; |
| 54 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; | 54 header.Flags = WNODE_FLAG_TRACED_GUID | WNODE_FLAG_USE_MOF_PTR; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SetField(int field, size_t size, const void *data) { | 57 void SetField(int field, size_t size, const void *data) { |
| 58 // DCHECK(field < N); | 58 // DCHECK(field < N); |
| 59 if (field < N) { | 59 if ((field < N) && (size <= kuint32max)) { |
| 60 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); | 60 fields[field].DataPtr = reinterpret_cast<ULONG64>(data); |
| 61 fields[field].Length = size; | 61 fields[field].Length = static_cast<ULONG>(size); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 EVENT_TRACE_HEADER* get() { return& header; } | 65 EVENT_TRACE_HEADER* get() { return& header; } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 DISALLOW_COPY_AND_ASSIGN(EtwMofEvent); | 68 DISALLOW_COPY_AND_ASSIGN(EtwMofEvent); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Trace provider with Event Tracing for Windows. The trace provider | 71 // Trace provider with Event Tracing for Windows. The trace provider |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 EtwEventLevel enable_level_; | 146 EtwEventLevel enable_level_; |
| 147 | 147 |
| 148 // We don't use this, but on XP we're obliged to pass one in to | 148 // We don't use this, but on XP we're obliged to pass one in to |
| 149 // RegisterTraceGuids. Non-const, because that's how the API needs it. | 149 // RegisterTraceGuids. Non-const, because that's how the API needs it. |
| 150 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; | 150 static TRACE_GUID_REGISTRATION obligatory_guid_registration_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); | 152 DISALLOW_COPY_AND_ASSIGN(EtwTraceProvider); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 #endif // BASE_EVENT_TRACE_PROVIDER_WIN_H_ | 155 #endif // BASE_EVENT_TRACE_PROVIDER_WIN_H_ |
| OLD | NEW |