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

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

Issue 1874813002: mash: Disable gpu in chrome when running as a mus client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODO Created 4 years, 8 months 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 | no next file » | 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 30 matching lines...) Expand all
41 41
42 #if defined(OS_MACOSX) 42 #if defined(OS_MACOSX)
43 #include <ApplicationServices/ApplicationServices.h> 43 #include <ApplicationServices/ApplicationServices.h>
44 #endif // OS_MACOSX 44 #endif // OS_MACOSX
45 #if defined(OS_WIN) 45 #if defined(OS_WIN)
46 #include "base/win/windows_version.h" 46 #include "base/win/windows_version.h"
47 #endif // OS_WIN 47 #endif // OS_WIN
48 #if defined(OS_ANDROID) 48 #if defined(OS_ANDROID)
49 #include "ui/gfx/android/device_display_info.h" 49 #include "ui/gfx/android/device_display_info.h"
50 #endif // OS_ANDROID 50 #endif // OS_ANDROID
51 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
52 #include "content/common/mojo/mojo_shell_connection_impl.h"
53 #endif
51 54
52 namespace content { 55 namespace content {
53 56
54 namespace { 57 namespace {
55 58
56 enum GpuFeatureStatus { 59 enum GpuFeatureStatus {
57 kGpuFeatureEnabled = 0, 60 kGpuFeatureEnabled = 0,
58 kGpuFeatureBlacklisted = 1, 61 kGpuFeatureBlacklisted = 1,
59 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted 62 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted
60 kGpuFeatureNumStatus 63 kGpuFeatureNumStatus
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const int kNumResetsWithinDuration = 1; 247 const int kNumResetsWithinDuration = 1;
245 248
246 // Enums for UMA histograms. 249 // Enums for UMA histograms.
247 enum BlockStatusHistogram { 250 enum BlockStatusHistogram {
248 BLOCK_STATUS_NOT_BLOCKED, 251 BLOCK_STATUS_NOT_BLOCKED,
249 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, 252 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED,
250 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, 253 BLOCK_STATUS_ALL_DOMAINS_BLOCKED,
251 BLOCK_STATUS_MAX 254 BLOCK_STATUS_MAX
252 }; 255 };
253 256
257 bool ShouldDisableHardwareAcceleration() {
258 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
259 // TODO(rjkroege): Remove this when https://crbug.com/602519 is fixed.
260 if (IsRunningInMojoShell())
261 return true;
262 #endif
263 return base::CommandLine::ForCurrentProcess()->HasSwitch(
264 switches::kDisableGpu);
265 }
266
254 } // namespace anonymous 267 } // namespace anonymous
255 268
256 void GpuDataManagerImplPrivate::InitializeForTesting( 269 void GpuDataManagerImplPrivate::InitializeForTesting(
257 const std::string& gpu_blacklist_json, 270 const std::string& gpu_blacklist_json,
258 const gpu::GPUInfo& gpu_info) { 271 const gpu::GPUInfo& gpu_info) {
259 // This function is for testing only, so disable histograms. 272 // This function is for testing only, so disable histograms.
260 update_histograms_ = false; 273 update_histograms_ = false;
261 274
262 // Prevent all further initialization. 275 // Prevent all further initialization.
263 finalized_ = true; 276 finalized_ = true;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 if (command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { 919 if (command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
907 // It was already disabled on the command line. 920 // It was already disabled on the command line.
908 return false; 921 return false;
909 } 922 }
910 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE)) 923 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE))
911 return true; 924 return true;
912 if (group_name == "Disabled") 925 if (group_name == "Disabled")
913 return true; 926 return true;
914 927
915 // Accelerated decode is never available with --disable-gpu. 928 // Accelerated decode is never available with --disable-gpu.
916 return command_line->HasSwitch(switches::kDisableGpu); 929 return ShouldDisableHardwareAcceleration();
917 } 930 }
918 931
919 void GpuDataManagerImplPrivate::GetDisabledExtensions( 932 void GpuDataManagerImplPrivate::GetDisabledExtensions(
920 std::string* disabled_extensions) const { 933 std::string* disabled_extensions) const {
921 DCHECK(disabled_extensions); 934 DCHECK(disabled_extensions);
922 *disabled_extensions = disabled_extensions_; 935 *disabled_extensions = disabled_extensions_;
923 } 936 }
924 937
925 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs( 938 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs(
926 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) { 939 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 owner_(owner), 980 owner_(owner),
968 gpu_process_accessible_(true), 981 gpu_process_accessible_(true),
969 is_initialized_(false), 982 is_initialized_(false),
970 finalized_(false) { 983 finalized_(false) {
971 DCHECK(owner_); 984 DCHECK(owner_);
972 const base::CommandLine* command_line = 985 const base::CommandLine* command_line =
973 base::CommandLine::ForCurrentProcess(); 986 base::CommandLine::ForCurrentProcess();
974 swiftshader_path_ = 987 swiftshader_path_ =
975 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( 988 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
976 switches::kSwiftShaderPath); 989 switches::kSwiftShaderPath);
977 if (command_line->HasSwitch(switches::kDisableGpu)) 990 if (ShouldDisableHardwareAcceleration())
978 DisableHardwareAcceleration(); 991 DisableHardwareAcceleration();
979 992
980 #if defined(OS_MACOSX) 993 #if defined(OS_MACOSX)
981 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); 994 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_);
982 #endif // OS_MACOSX 995 #endif // OS_MACOSX
983 996
984 // For testing only. 997 // For testing only.
985 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { 998 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) {
986 domain_blocking_enabled_ = false; 999 domain_blocking_enabled_ = false;
987 } 1000 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1210 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1198 #if defined(OS_WIN) 1211 #if defined(OS_WIN)
1199 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1212 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1200 #endif 1213 #endif
1201 complete_gpu_info_already_requested_ = true; 1214 complete_gpu_info_already_requested_ = true;
1202 // Some observers might be waiting. 1215 // Some observers might be waiting.
1203 NotifyGpuInfoUpdate(); 1216 NotifyGpuInfoUpdate();
1204 } 1217 }
1205 1218
1206 } // namespace content 1219 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698