| 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 #include "gpu/config/gpu_info_collector.h" | 5 #include "gpu/config/gpu_info_collector.h" |
| 6 | 6 |
| 7 // This has to be included before windows.h. | 7 // This has to be included before windows.h. |
| 8 #include "third_party/re2/re2/re2.h" | 8 #include "third_party/re2/re2/re2.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| 11 #include <d3d9.h> | 11 #include <d3d9.h> |
| 12 #include <d3d11.h> | 12 #include <d3d11.h> |
| 13 #include <dxgi.h> | 13 #include <dxgi.h> |
| 14 #include <setupapi.h> | 14 #include <setupapi.h> |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/debug/trace_event.h" | 17 #include "base/debug/trace_event.h" |
| 18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
| 19 #include "base/file_util.h" | 19 #include "base/file_util.h" |
| 20 #include "base/files/file_enumerator.h" |
| 20 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
| 21 #include "base/logging.h" | 22 #include "base/logging.h" |
| 22 #include "base/message_loop.h" | 23 #include "base/message_loop.h" |
| 23 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
| 24 #include "base/scoped_native_library.h" | 25 #include "base/scoped_native_library.h" |
| 25 #include "base/string_number_conversions.h" | 26 #include "base/string_number_conversions.h" |
| 26 #include "base/string_util.h" | 27 #include "base/string_util.h" |
| 27 #include "base/string16.h" | 28 #include "base/string16.h" |
| 28 #include "base/stringprintf.h" | 29 #include "base/stringprintf.h" |
| 29 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 DWORD size = ExpandEnvironmentStrings( | 74 DWORD size = ExpandEnvironmentStrings( |
| 74 L"%WinDir%\\Performance\\WinSAT\\DataStore\\", | 75 L"%WinDir%\\Performance\\WinSAT\\DataStore\\", |
| 75 winsat_results_path, MAX_PATH); | 76 winsat_results_path, MAX_PATH); |
| 76 if (size == 0 || size > MAX_PATH) { | 77 if (size == 0 || size > MAX_PATH) { |
| 77 LOG(ERROR) << "The path to the WinSAT results is too long: " | 78 LOG(ERROR) << "The path to the WinSAT results is too long: " |
| 78 << size << " chars."; | 79 << size << " chars."; |
| 79 return stats; | 80 return stats; |
| 80 } | 81 } |
| 81 | 82 |
| 82 // Find most recent formal assessment results. | 83 // Find most recent formal assessment results. |
| 83 file_util::FileEnumerator file_enumerator( | 84 base::FileEnumerator file_enumerator( |
| 84 base::FilePath(winsat_results_path), | 85 base::FilePath(winsat_results_path), |
| 85 false, // not recursive | 86 false, // not recursive |
| 86 file_util::FileEnumerator::FILES, | 87 base::FileEnumerator::FILES, |
| 87 FILE_PATH_LITERAL("* * Formal.Assessment (*).WinSAT.xml")); | 88 FILE_PATH_LITERAL("* * Formal.Assessment (*).WinSAT.xml")); |
| 88 | 89 |
| 89 base::FilePath current_results; | 90 base::FilePath current_results; |
| 90 for (base::FilePath results = file_enumerator.Next(); !results.empty(); | 91 for (base::FilePath results = file_enumerator.Next(); !results.empty(); |
| 91 results = file_enumerator.Next()) { | 92 results = file_enumerator.Next()) { |
| 92 // The filenames start with the date and time as yyyy-mm-dd hh.mm.ss.xxx, | 93 // The filenames start with the date and time as yyyy-mm-dd hh.mm.ss.xxx, |
| 93 // so the greatest file lexicographically is also the most recent file. | 94 // so the greatest file lexicographically is also the most recent file. |
| 94 if (base::FilePath::CompareLessIgnoreCase(current_results.value(), | 95 if (base::FilePath::CompareLessIgnoreCase(current_results.value(), |
| 95 results.value())) | 96 results.value())) |
| 96 current_results = results; | 97 current_results = results; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 basic_gpu_info->software_rendering = true; | 640 basic_gpu_info->software_rendering = true; |
| 640 return; | 641 return; |
| 641 } | 642 } |
| 642 | 643 |
| 643 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 644 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 644 | 645 |
| 645 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; | 646 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; |
| 646 } | 647 } |
| 647 | 648 |
| 648 } // namespace gpu | 649 } // namespace gpu |
| OLD | NEW |