Chromium Code Reviews| 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> | |
| 8 #include <iterator> | |
| 7 #include <memory> | 9 #include <memory> |
| 8 #include <utility> | 10 #include <utility> |
| 9 | 11 |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 13 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
| 14 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 16 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 if (command_line->HasSwitch(switches::kDisableGpu)) | 342 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 341 *reason += "through commandline switch --disable-gpu."; | 343 *reason += "through commandline switch --disable-gpu."; |
| 342 else | 344 else |
| 343 *reason += "in chrome://settings."; | 345 *reason += "in chrome://settings."; |
| 344 } | 346 } |
| 345 return false; | 347 return false; |
| 346 } | 348 } |
| 347 | 349 |
| 348 // We only need to block GPU process if more features are disallowed other | 350 // We only need to block GPU process if more features are disallowed other |
| 349 // than those in the preliminary gpu feature flags because the latter work | 351 // than those in the preliminary gpu feature flags because the latter work |
| 350 // through renderer commandline switches. | 352 // through renderer commandline switches. WebGL and WebGL2 should not matter |
| 351 std::set<int> features = preliminary_blacklisted_features_; | 353 // because their context creation can always be rejected on the GPU process |
| 352 gpu::MergeFeatureSets(&features, blacklisted_features_); | 354 // side. |
|
Ken Russell (switch to Gerrit)
2016/11/15 01:25:14
Would other GPU acceleration features also be good
Zhenyao Mo
2016/11/15 01:38:21
Might be. Good point. Added.
| |
| 353 if (features.size() > preliminary_blacklisted_features_.size()) { | 355 std::set<int> feature_diffs; |
| 356 std::set_difference(blacklisted_features_.begin(), | |
| 357 blacklisted_features_.end(), | |
| 358 preliminary_blacklisted_features_.begin(), | |
| 359 preliminary_blacklisted_features_.end(), | |
| 360 std::inserter(feature_diffs, feature_diffs.begin())); | |
| 361 if (feature_diffs.size()) { | |
| 362 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL); | |
| 363 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL2); | |
| 364 } | |
| 365 if (feature_diffs.size()) { | |
| 354 if (reason) { | 366 if (reason) { |
| 355 *reason = "Features are disabled upon full but not preliminary GPU info."; | 367 *reason = "Features are disabled on full but not preliminary GPU info."; |
| 356 } | 368 } |
| 357 return false; | 369 return false; |
| 358 } | 370 } |
| 359 | 371 |
| 360 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) { | 372 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) { |
| 361 // On Linux, we use cached GL strings to make blacklist decsions at browser | 373 // On Linux, we use cached GL strings to make blacklist decsions at browser |
| 362 // startup time. We need to launch the GPU process to validate these | 374 // startup time. We need to launch the GPU process to validate these |
| 363 // strings even if all features are blacklisted. If all GPU features are | 375 // strings even if all features are blacklisted. If all GPU features are |
| 364 // disabled, the GPU process will only initialize GL bindings, create a GL | 376 // disabled, the GPU process will only initialize GL bindings, create a GL |
| 365 // context, and collect full GPU info. | 377 // context, and collect full GPU info. |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1308 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1320 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1309 #if defined(OS_WIN) | 1321 #if defined(OS_WIN) |
| 1310 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1322 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1311 #endif | 1323 #endif |
| 1312 complete_gpu_info_already_requested_ = true; | 1324 complete_gpu_info_already_requested_ = true; |
| 1313 // Some observers might be waiting. | 1325 // Some observers might be waiting. |
| 1314 NotifyGpuInfoUpdate(); | 1326 NotifyGpuInfoUpdate(); |
| 1315 } | 1327 } |
| 1316 | 1328 |
| 1317 } // namespace content | 1329 } // namespace content |
| OLD | NEW |