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 // Functions to enumerate the Dx Diagnostic Tool hierarchy and build up | 5 // Functions to enumerate the Dx Diagnostic Tool hierarchy and build up |
6 // a tree of nodes with name / value properties. | 6 // a tree of nodes with name / value properties. |
7 | 7 |
8 #define INITGUID | 8 #define INITGUID |
9 #include <dxdiag.h> | 9 #include <dxdiag.h> |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 18 matching lines...) Expand all Loading... |
29 VARIANT variant; | 29 VARIANT variant; |
30 VariantInit(&variant); | 30 VariantInit(&variant); |
31 | 31 |
32 DWORD prop_count; | 32 DWORD prop_count; |
33 hr = container->GetNumberOfProps(&prop_count); | 33 hr = container->GetNumberOfProps(&prop_count); |
34 if (SUCCEEDED(hr)) { | 34 if (SUCCEEDED(hr)) { |
35 for (DWORD i = 0; i < prop_count; i++) { | 35 for (DWORD i = 0; i < prop_count; i++) { |
36 WCHAR prop_name16[256]; | 36 WCHAR prop_name16[256]; |
37 hr = container->EnumPropNames(i, prop_name16, arraysize(prop_name16)); | 37 hr = container->EnumPropNames(i, prop_name16, arraysize(prop_name16)); |
38 if (SUCCEEDED(hr)) { | 38 if (SUCCEEDED(hr)) { |
39 std::string prop_name8 = WideToUTF8(prop_name16); | 39 std::string prop_name8 = base::WideToUTF8(prop_name16); |
40 | 40 |
41 hr = container->GetProp(prop_name16, &variant); | 41 hr = container->GetProp(prop_name16, &variant); |
42 if (SUCCEEDED(hr)) { | 42 if (SUCCEEDED(hr)) { |
43 switch (variant.vt) { | 43 switch (variant.vt) { |
44 case VT_UI4: | 44 case VT_UI4: |
45 output->values[prop_name8] = base::UintToString(variant.ulVal); | 45 output->values[prop_name8] = base::UintToString(variant.ulVal); |
46 break; | 46 break; |
47 case VT_I4: | 47 case VT_I4: |
48 output->values[prop_name8] = base::IntToString(variant.lVal); | 48 output->values[prop_name8] = base::IntToString(variant.lVal); |
49 break; | 49 break; |
50 case VT_BOOL: | 50 case VT_BOOL: |
51 output->values[prop_name8] = variant.boolVal ? "true" : "false"; | 51 output->values[prop_name8] = variant.boolVal ? "true" : "false"; |
52 break; | 52 break; |
53 case VT_BSTR: | 53 case VT_BSTR: |
54 output->values[prop_name8] = WideToUTF8(variant.bstrVal); | 54 output->values[prop_name8] = base::WideToUTF8(variant.bstrVal); |
55 break; | 55 break; |
56 default: | 56 default: |
57 break; | 57 break; |
58 } | 58 } |
59 | 59 |
60 // Clear the variant (this is needed to free BSTR memory). | 60 // Clear the variant (this is needed to free BSTR memory). |
61 VariantClear(&variant); | 61 VariantClear(&variant); |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 if (depth > 0) { | 67 if (depth > 0) { |
68 DWORD child_count; | 68 DWORD child_count; |
69 hr = container->GetNumberOfChildContainers(&child_count); | 69 hr = container->GetNumberOfChildContainers(&child_count); |
70 if (SUCCEEDED(hr)) { | 70 if (SUCCEEDED(hr)) { |
71 for (DWORD i = 0; i < child_count; i++) { | 71 for (DWORD i = 0; i < child_count; i++) { |
72 WCHAR child_name16[256]; | 72 WCHAR child_name16[256]; |
73 hr = container->EnumChildContainerNames(i, | 73 hr = container->EnumChildContainerNames(i, |
74 child_name16, | 74 child_name16, |
75 arraysize(child_name16)); | 75 arraysize(child_name16)); |
76 if (SUCCEEDED(hr)) { | 76 if (SUCCEEDED(hr)) { |
77 std::string child_name8 = WideToUTF8(child_name16); | 77 std::string child_name8 = base::WideToUTF8(child_name16); |
78 DxDiagNode* output_child = &output->children[child_name8]; | 78 DxDiagNode* output_child = &output->children[child_name8]; |
79 | 79 |
80 IDxDiagContainer* child_container = NULL; | 80 IDxDiagContainer* child_container = NULL; |
81 hr = container->GetChildContainer(child_name16, &child_container); | 81 hr = container->GetChildContainer(child_name16, &child_container); |
82 if (SUCCEEDED(hr)) { | 82 if (SUCCEEDED(hr)) { |
83 RecurseDiagnosticTree(output_child, child_container, depth - 1); | 83 RecurseDiagnosticTree(output_child, child_container, depth - 1); |
84 | 84 |
85 child_container->Release(); | 85 child_container->Release(); |
86 } | 86 } |
87 } | 87 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 root->Release(); | 127 root->Release(); |
128 } | 128 } |
129 } | 129 } |
130 provider->Release(); | 130 provider->Release(); |
131 } | 131 } |
132 | 132 |
133 return success; | 133 return success; |
134 } | 134 } |
135 } // namespace gpu | 135 } // namespace gpu |
OLD | NEW |