OLD | NEW |
1 // Copyright (c) 2012 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 #ifndef CHROME_TEST_LOGGING_WIN_MOF_DATA_PARSER_H_ | 5 #ifndef CHROME_TEST_LOGGING_WIN_MOF_DATA_PARSER_H_ |
6 #define CHROME_TEST_LOGGING_WIN_MOF_DATA_PARSER_H_ | 6 #define CHROME_TEST_LOGGING_WIN_MOF_DATA_PARSER_H_ |
7 | 7 |
| 8 #include <windows.h> |
| 9 #include <evntrace.h> |
8 #include <stddef.h> | 10 #include <stddef.h> |
9 #include <windows.h> | 11 #include <stdint.h> |
10 #include <wmistr.h> | 12 #include <wmistr.h> |
11 #include <evntrace.h> | |
12 | 13 |
13 #include "base/basictypes.h" | |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 | 15 |
16 namespace logging_win { | 16 namespace logging_win { |
17 | 17 |
18 // A parser for Mof data found in an EVENT_TRACE object as formatted by | 18 // A parser for Mof data found in an EVENT_TRACE object as formatted by |
19 // Chromium-related classes. Instances have an implicit cursor that scans the | 19 // Chromium-related classes. Instances have an implicit cursor that scans the |
20 // data. Callers invoke Read* methods to extract primitive data types values or | 20 // data. Callers invoke Read* methods to extract primitive data types values or |
21 // pointers to complex data types (arrays and strings). In the latter case, the | 21 // pointers to complex data types (arrays and strings). In the latter case, the |
22 // pointers are only valid for the lifetime of the underlying event. | 22 // pointers are only valid for the lifetime of the underlying event. |
23 class MofDataParser { | 23 class MofDataParser { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 template<typename T> bool ReadPrimitiveArray(DWORD size, const T** values) { | 76 template<typename T> bool ReadPrimitiveArray(DWORD size, const T** values) { |
77 if (length_ < sizeof(**values) * size) | 77 if (length_ < sizeof(**values) * size) |
78 return false; | 78 return false; |
79 *values = reinterpret_cast<const T*>(scan_); | 79 *values = reinterpret_cast<const T*>(scan_); |
80 Advance(sizeof(**values) * size); | 80 Advance(sizeof(**values) * size); |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 const uint8* scan_; | 84 const uint8_t* scan_; |
85 uint32 length_; | 85 uint32_t length_; |
86 }; | 86 }; |
87 | 87 |
88 } // namespace logging_win | 88 } // namespace logging_win |
89 | 89 |
90 #endif // CHROME_TEST_LOGGING_WIN_MOF_DATA_PARSER_H_ | 90 #endif // CHROME_TEST_LOGGING_WIN_MOF_DATA_PARSER_H_ |
OLD | NEW |