OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/gpu/gpu_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_piece.h" |
19 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
21 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
22 #include "base/version.h" | 23 #include "base/version.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 #include "cc/base/switches.h" | 25 #include "cc/base/switches.h" |
25 #include "content/browser/gpu/gpu_process_host.h" | 26 #include "content/browser/gpu/gpu_process_host.h" |
26 #include "content/common/gpu_host_messages.h" | 27 #include "content/common/gpu_host_messages.h" |
27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/gpu_data_manager_observer.h" | 29 #include "content/public/browser/gpu_data_manager_observer.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 637 |
637 if (gpu_blacklist_) { | 638 if (gpu_blacklist_) { |
638 std::set<int> features = gpu_blacklist_->MakeDecision( | 639 std::set<int> features = gpu_blacklist_->MakeDecision( |
639 gpu::GpuControlList::kOsAny, os_version, gpu_info_); | 640 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
640 if (update_histograms_) | 641 if (update_histograms_) |
641 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 642 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
642 | 643 |
643 UpdateBlacklistedFeatures(features); | 644 UpdateBlacklistedFeatures(features); |
644 } | 645 } |
645 | 646 |
646 std::set<std::string> disabled_ext_set; | 647 std::string command_line_disable_gl_extensions; |
| 648 std::vector<std::string> disabled_driver_bug_exts; |
| 649 // Holds references to strings in the above two variables. |
| 650 std::set<base::StringPiece> disabled_ext_set; |
647 | 651 |
648 // Merge disabled extensions from the command line with gpu driver bug list. | 652 // Merge disabled extensions from the command line with gpu driver bug list. |
649 if (command_line) { | 653 if (command_line) { |
650 const std::vector<std::string>& disabled_command_line_exts = | 654 command_line_disable_gl_extensions = |
651 base::SplitString( | 655 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions); |
652 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), | 656 std::vector<base::StringPiece> disabled_command_line_exts = |
653 ", ;", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 657 base::SplitStringPiece(command_line_disable_gl_extensions, ", ;", |
| 658 base::KEEP_WHITESPACE, |
| 659 base::SPLIT_WANT_NONEMPTY); |
654 disabled_ext_set.insert(disabled_command_line_exts.begin(), | 660 disabled_ext_set.insert(disabled_command_line_exts.begin(), |
655 disabled_command_line_exts.end()); | 661 disabled_command_line_exts.end()); |
656 } | 662 } |
657 | 663 |
658 if (gpu_driver_bug_list_) { | 664 if (gpu_driver_bug_list_) { |
659 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 665 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
660 gpu::GpuControlList::kOsAny, os_version, gpu_info_); | 666 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
661 | 667 |
662 const std::vector<std::string>& disabled_driver_bug_exts = | 668 disabled_driver_bug_exts = gpu_driver_bug_list_->GetDisabledExtensions(); |
663 gpu_driver_bug_list_->GetDisabledExtensions(); | |
664 disabled_ext_set.insert(disabled_driver_bug_exts.begin(), | 669 disabled_ext_set.insert(disabled_driver_bug_exts.begin(), |
665 disabled_driver_bug_exts.end()); | 670 disabled_driver_bug_exts.end()); |
666 } | 671 } |
667 disabled_extensions_ = | 672 disabled_extensions_ = |
668 base::JoinString(std::vector<std::string>(disabled_ext_set.begin(), | 673 base::JoinString(std::vector<base::StringPiece>(disabled_ext_set.begin(), |
669 disabled_ext_set.end()), | 674 disabled_ext_set.end()), |
670 " "); | 675 " "); |
671 | 676 |
672 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 677 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
673 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); | 678 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); |
674 | 679 |
675 // We have to update GpuFeatureType before notify all the observers. | 680 // We have to update GpuFeatureType before notify all the observers. |
676 NotifyGpuInfoUpdate(); | 681 NotifyGpuInfoUpdate(); |
677 } | 682 } |
678 | 683 |
679 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { | 684 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1367 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1363 #if defined(OS_WIN) | 1368 #if defined(OS_WIN) |
1364 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1369 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1365 #endif | 1370 #endif |
1366 complete_gpu_info_already_requested_ = true; | 1371 complete_gpu_info_already_requested_ = true; |
1367 // Some observers might be waiting. | 1372 // Some observers might be waiting. |
1368 NotifyGpuInfoUpdate(); | 1373 NotifyGpuInfoUpdate(); |
1369 } | 1374 } |
1370 | 1375 |
1371 } // namespace content | 1376 } // namespace content |
OLD | NEW |