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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 654 |
654 if (gpu_blacklist_) { | 655 if (gpu_blacklist_) { |
655 std::set<int> features = gpu_blacklist_->MakeDecision( | 656 std::set<int> features = gpu_blacklist_->MakeDecision( |
656 gpu::GpuControlList::kOsAny, os_version, gpu_info_); | 657 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
657 if (update_histograms_) | 658 if (update_histograms_) |
658 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 659 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
659 | 660 |
660 UpdateBlacklistedFeatures(features); | 661 UpdateBlacklistedFeatures(features); |
661 } | 662 } |
662 | 663 |
663 std::set<std::string> disabled_ext_set; | 664 std::string command_line_disable_gl_extensions; |
| 665 std::vector<std::string> disabled_driver_bug_exts; |
| 666 // Holds references to strings in the above two variables. |
| 667 std::set<base::StringPiece> disabled_ext_set; |
664 | 668 |
665 // Merge disabled extensions from the command line with gpu driver bug list. | 669 // Merge disabled extensions from the command line with gpu driver bug list. |
666 if (command_line) { | 670 if (command_line) { |
667 const std::vector<std::string>& disabled_command_line_exts = | 671 command_line_disable_gl_extensions = |
668 base::SplitString( | 672 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions); |
669 command_line->GetSwitchValueASCII(switches::kDisableGLExtensions), | 673 std::vector<base::StringPiece> disabled_command_line_exts = |
670 ", ;", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 674 base::SplitStringPiece(command_line_disable_gl_extensions, ", ;", |
| 675 base::KEEP_WHITESPACE, |
| 676 base::SPLIT_WANT_NONEMPTY); |
671 disabled_ext_set.insert(disabled_command_line_exts.begin(), | 677 disabled_ext_set.insert(disabled_command_line_exts.begin(), |
672 disabled_command_line_exts.end()); | 678 disabled_command_line_exts.end()); |
673 } | 679 } |
674 | 680 |
675 if (gpu_driver_bug_list_) { | 681 if (gpu_driver_bug_list_) { |
676 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 682 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
677 gpu::GpuControlList::kOsAny, os_version, gpu_info_); | 683 gpu::GpuControlList::kOsAny, os_version, gpu_info_); |
678 | 684 |
679 const std::vector<std::string>& disabled_driver_bug_exts = | 685 disabled_driver_bug_exts = gpu_driver_bug_list_->GetDisabledExtensions(); |
680 gpu_driver_bug_list_->GetDisabledExtensions(); | |
681 disabled_ext_set.insert(disabled_driver_bug_exts.begin(), | 686 disabled_ext_set.insert(disabled_driver_bug_exts.begin(), |
682 disabled_driver_bug_exts.end()); | 687 disabled_driver_bug_exts.end()); |
683 } | 688 } |
684 disabled_extensions_ = | 689 disabled_extensions_ = |
685 base::JoinString(std::vector<std::string>(disabled_ext_set.begin(), | 690 base::JoinString(std::vector<base::StringPiece>(disabled_ext_set.begin(), |
686 disabled_ext_set.end()), | 691 disabled_ext_set.end()), |
687 " "); | 692 " "); |
688 | 693 |
689 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( | 694 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine( |
690 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); | 695 &gpu_driver_bugs_, *base::CommandLine::ForCurrentProcess()); |
691 | 696 |
692 // We have to update GpuFeatureType before notify all the observers. | 697 // We have to update GpuFeatureType before notify all the observers. |
693 NotifyGpuInfoUpdate(); | 698 NotifyGpuInfoUpdate(); |
694 } | 699 } |
695 | 700 |
696 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { | 701 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1384 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1380 #if defined(OS_WIN) | 1385 #if defined(OS_WIN) |
1381 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1386 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1382 #endif | 1387 #endif |
1383 complete_gpu_info_already_requested_ = true; | 1388 complete_gpu_info_already_requested_ = true; |
1384 // Some observers might be waiting. | 1389 // Some observers might be waiting. |
1385 NotifyGpuInfoUpdate(); | 1390 NotifyGpuInfoUpdate(); |
1386 } | 1391 } |
1387 | 1392 |
1388 } // namespace content | 1393 } // namespace content |
OLD | NEW |