| 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> |
| 11 | 11 |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/win/scoped_com_initializer.h" |
| 14 #include "content/gpu/gpu_info_collector.h" | 15 #include "content/gpu/gpu_info_collector.h" |
| 15 | 16 |
| 16 // Functions in this file depend on functions exported from dxguid.dll. | 17 // Functions in this file depend on functions exported from dxguid.dll. |
| 17 #pragma comment(lib, "dxguid.lib") | 18 #pragma comment(lib, "dxguid.lib") |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // Traverses the IDxDiagContainer tree and populates a tree of DxDiagNode | 22 // Traverses the IDxDiagContainer tree and populates a tree of DxDiagNode |
| 22 // structures that contains property name / value pairs and subtrees of DirectX | 23 // structures that contains property name / value pairs and subtrees of DirectX |
| 23 // diagnostic information. | 24 // diagnostic information. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 91 } |
| 91 } | 92 } |
| 92 } | 93 } |
| 93 } // namespace anonymous | 94 } // namespace anonymous |
| 94 | 95 |
| 95 namespace gpu_info_collector { | 96 namespace gpu_info_collector { |
| 96 | 97 |
| 97 bool GetDxDiagnostics(content::DxDiagNode* output) { | 98 bool GetDxDiagnostics(content::DxDiagNode* output) { |
| 98 HRESULT hr; | 99 HRESULT hr; |
| 99 bool success = false; | 100 bool success = false; |
| 101 base::win::ScopedCOMInitializer com_initializer; |
| 100 | 102 |
| 101 IDxDiagProvider* provider = NULL; | 103 IDxDiagProvider* provider = NULL; |
| 102 hr = CoCreateInstance(CLSID_DxDiagProvider, | 104 hr = CoCreateInstance(CLSID_DxDiagProvider, |
| 103 NULL, | 105 NULL, |
| 104 CLSCTX_INPROC_SERVER, | 106 CLSCTX_INPROC_SERVER, |
| 105 IID_IDxDiagProvider, | 107 IID_IDxDiagProvider, |
| 106 reinterpret_cast<void**>(&provider)); | 108 reinterpret_cast<void**>(&provider)); |
| 107 if (SUCCEEDED(hr)) { | 109 if (SUCCEEDED(hr)) { |
| 108 DXDIAG_INIT_PARAMS params = { sizeof(params) }; | 110 DXDIAG_INIT_PARAMS params = { sizeof(params) }; |
| 109 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION; | 111 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 128 | 130 |
| 129 root->Release(); | 131 root->Release(); |
| 130 } | 132 } |
| 131 } | 133 } |
| 132 provider->Release(); | 134 provider->Release(); |
| 133 } | 135 } |
| 134 | 136 |
| 135 return success; | 137 return success; |
| 136 } | 138 } |
| 137 } // namespace gpu_info_collector | 139 } // namespace gpu_info_collector |
| OLD | NEW |