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 "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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "base/version.h" | 17 #include "base/version.h" |
18 #include "cc/base/switches.h" | 18 #include "cc/base/switches.h" |
19 #include "content/browser/gpu/gpu_process_host.h" | 19 #include "content/browser/gpu/gpu_process_host.h" |
20 #include "content/common/gpu/gpu_messages.h" | 20 #include "content/common/gpu/gpu_messages.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/content_browser_client.h" | |
22 #include "content/public/browser/gpu_data_manager_observer.h" | 23 #include "content/public/browser/gpu_data_manager_observer.h" |
23 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
24 #include "content/public/common/content_constants.h" | 25 #include "content/public/common/content_constants.h" |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
26 #include "gpu/command_buffer/service/gpu_switches.h" | 27 #include "gpu/command_buffer/service/gpu_switches.h" |
27 #include "gpu/config/gpu_control_list_jsons.h" | 28 #include "gpu/config/gpu_control_list_jsons.h" |
28 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 29 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
29 #include "gpu/config/gpu_feature_type.h" | 30 #include "gpu/config/gpu_feature_type.h" |
30 #include "gpu/config/gpu_info_collector.h" | 31 #include "gpu/config/gpu_info_collector.h" |
31 #include "gpu/config/gpu_util.h" | 32 #include "gpu/config/gpu_util.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 const int kNumResetsWithinDuration = 1; | 306 const int kNumResetsWithinDuration = 1; |
306 | 307 |
307 // Enums for UMA histograms. | 308 // Enums for UMA histograms. |
308 enum BlockStatusHistogram { | 309 enum BlockStatusHistogram { |
309 BLOCK_STATUS_NOT_BLOCKED, | 310 BLOCK_STATUS_NOT_BLOCKED, |
310 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, | 311 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, |
311 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, | 312 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, |
312 BLOCK_STATUS_MAX | 313 BLOCK_STATUS_MAX |
313 }; | 314 }; |
314 | 315 |
316 bool IsWebGLDebugRendererInfoFieldTrialEnabled() { | |
317 const char kWebGLDebugRendererInfoFieldTrialName[] = "WebGLDebugRendererInfo"; | |
318 const char kWebGLDebugRendererInfoFieldTrialEnabledName[] = "enabled"; | |
319 | |
320 base::FieldTrial* trial = base::FieldTrialList::Find( | |
321 kWebGLDebugRendererInfoFieldTrialName); | |
322 if (!trial) | |
323 return false; | |
324 return trial->group_name() == kWebGLDebugRendererInfoFieldTrialEnabledName; | |
Alexei Svitkine (slow)
2013/10/30 18:10:18
Instead, just use base::FieldTrialList::FindFullNa
Zhenyao Mo
2013/10/30 20:20:50
Done.
See chrome_render_message_filter.cc
| |
325 } | |
326 | |
315 } // namespace anonymous | 327 } // namespace anonymous |
316 | 328 |
317 void GpuDataManagerImplPrivate::InitializeForTesting( | 329 void GpuDataManagerImplPrivate::InitializeForTesting( |
318 const std::string& gpu_blacklist_json, | 330 const std::string& gpu_blacklist_json, |
319 const gpu::GPUInfo& gpu_info) { | 331 const gpu::GPUInfo& gpu_info) { |
320 // This function is for testing only, so disable histograms. | 332 // This function is for testing only, so disable histograms. |
321 update_histograms_ = false; | 333 update_histograms_ = false; |
322 | 334 |
323 // Prevent all further initialization. | 335 // Prevent all further initialization. |
324 finalized_ = true; | 336 finalized_ = true; |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1252 | 1264 |
1253 void GpuDataManagerImplPrivate::Notify3DAPIBlocked(const GURL& url, | 1265 void GpuDataManagerImplPrivate::Notify3DAPIBlocked(const GURL& url, |
1254 int render_process_id, | 1266 int render_process_id, |
1255 int render_view_id, | 1267 int render_view_id, |
1256 ThreeDAPIType requester) { | 1268 ThreeDAPIType requester) { |
1257 GpuDataManagerImpl::UnlockedSession session(owner_); | 1269 GpuDataManagerImpl::UnlockedSession session(owner_); |
1258 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, | 1270 observer_list_->Notify(&GpuDataManagerObserver::DidBlock3DAPIs, |
1259 url, render_process_id, render_view_id, requester); | 1271 url, render_process_id, render_view_id, requester); |
1260 } | 1272 } |
1261 | 1273 |
1274 bool GpuDataManagerImplPrivate::IsWebGLDebugRendererInfoAllowed( | |
1275 const GURL& url) const { | |
1276 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
1277 // Allow someone to disable this extension in WebGL. | |
1278 if (command_line->HasSwitch(switches::kDisableWebGLDebugRendererInfo)) | |
1279 return false; | |
1280 // Allow someone to force-enable this extension. This is mostly for | |
1281 // testing purpose. | |
1282 if (command_line->HasSwitch(switches::kEnableWebGLDebugRendererInfo)) | |
1283 return true; | |
Ken Russell (switch to Gerrit)
2013/10/29 23:15:35
The test of the kEnableWebGLDebugRendererInfo swit
Zhenyao Mo
2013/10/29 23:33:43
I just realized we can probably get rid of the kEn
Zhenyao Mo
2013/10/29 23:43:37
Never mind about this auto flag thing. I read the
Ken Russell (switch to Gerrit)
2013/10/29 23:58:16
OK. Using --force-fieldtrials and removing the kEn
| |
1284 | |
1285 if (!GetContentClient()->browser()->AllowWebGLDebugRendererInfoForDomain(url)) | |
1286 return false; | |
1287 return IsWebGLDebugRendererInfoFieldTrialEnabled(); | |
1288 } | |
1289 | |
1262 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1290 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1263 gpu_process_accessible_ = false; | 1291 gpu_process_accessible_ = false; |
1264 gpu_info_.finalized = true; | 1292 gpu_info_.finalized = true; |
1265 complete_gpu_info_already_requested_ = true; | 1293 complete_gpu_info_already_requested_ = true; |
1266 // Some observers might be waiting. | 1294 // Some observers might be waiting. |
1267 NotifyGpuInfoUpdate(); | 1295 NotifyGpuInfoUpdate(); |
1268 } | 1296 } |
1269 | 1297 |
1270 } // namespace content | 1298 } // namespace content |
OLD | NEW |