Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 2505473002: Don't forbid GPU process if WebGL/WebGL2 is disabled on GPU but not browser. (Closed)
Patch Set: adding TODO Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/gpu/gpu_data_manager_impl_private_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
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 // TODO(zmo): Other features might also be OK to ignore here.
363 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL);
364 feature_diffs.erase(gpu::GPU_FEATURE_TYPE_WEBGL2);
365 }
366 if (feature_diffs.size()) {
354 if (reason) { 367 if (reason) {
355 *reason = "Features are disabled upon full but not preliminary GPU info."; 368 *reason = "Features are disabled on full but not preliminary GPU info.";
356 } 369 }
357 return false; 370 return false;
358 } 371 }
359 372
360 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) { 373 if (blacklisted_features_.size() == gpu::NUMBER_OF_GPU_FEATURE_TYPES) {
361 // On Linux, we use cached GL strings to make blacklist decsions at browser 374 // 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 375 // 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 376 // 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 377 // disabled, the GPU process will only initialize GL bindings, create a GL
365 // context, and collect full GPU info. 378 // context, and collect full GPU info.
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1321 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1309 #if defined(OS_WIN) 1322 #if defined(OS_WIN)
1310 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1323 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1311 #endif 1324 #endif
1312 complete_gpu_info_already_requested_ = true; 1325 complete_gpu_info_already_requested_ = true;
1313 // Some observers might be waiting. 1326 // Some observers might be waiting.
1314 NotifyGpuInfoUpdate(); 1327 NotifyGpuInfoUpdate();
1315 } 1328 }
1316 1329
1317 } // namespace content 1330 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_data_manager_impl_private_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698