OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compositor_util.h" | 5 #include "content/browser/gpu/compositor_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" |
16 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
20 #include "cc/base/math_util.h" | 21 #include "cc/base/math_util.h" |
21 #include "cc/base/switches.h" | 22 #include "cc/base/switches.h" |
22 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 23 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
23 #include "content/browser/gpu/gpu_data_manager_impl.h" | 24 #include "content/browser/gpu/gpu_data_manager_impl.h" |
24 #include "content/public/browser/gpu_utils.h" | 25 #include "content/public/browser/gpu_utils.h" |
25 #include "content/public/common/content_features.h" | 26 #include "content/public/common/content_features.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 base::Value* GetProblems() { | 372 base::Value* GetProblems() { |
372 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 373 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
373 std::string gpu_access_blocked_reason; | 374 std::string gpu_access_blocked_reason; |
374 bool gpu_access_blocked = | 375 bool gpu_access_blocked = |
375 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); | 376 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); |
376 | 377 |
377 base::ListValue* problem_list = new base::ListValue(); | 378 base::ListValue* problem_list = new base::ListValue(); |
378 manager->GetBlacklistReasons(problem_list); | 379 manager->GetBlacklistReasons(problem_list); |
379 | 380 |
380 if (gpu_access_blocked) { | 381 if (gpu_access_blocked) { |
381 base::DictionaryValue* problem = new base::DictionaryValue(); | 382 auto problem = base::MakeUnique<base::DictionaryValue>(); |
382 problem->SetString("description", | 383 problem->SetString("description", |
383 "GPU process was unable to boot: " + gpu_access_blocked_reason); | 384 "GPU process was unable to boot: " + gpu_access_blocked_reason); |
384 problem->Set("crBugs", new base::ListValue()); | 385 problem->Set("crBugs", new base::ListValue()); |
385 problem->Set("webkitBugs", new base::ListValue()); | 386 problem->Set("webkitBugs", new base::ListValue()); |
386 base::ListValue* disabled_features = new base::ListValue(); | 387 base::ListValue* disabled_features = new base::ListValue(); |
387 disabled_features->AppendString("all"); | 388 disabled_features->AppendString("all"); |
388 problem->Set("affectedGpuSettings", disabled_features); | 389 problem->Set("affectedGpuSettings", disabled_features); |
389 problem->SetString("tag", "disabledFeatures"); | 390 problem->SetString("tag", "disabledFeatures"); |
390 problem_list->Insert(0, problem); | 391 problem_list->Insert(0, std::move(problem)); |
391 } | 392 } |
392 | 393 |
393 bool eof = false; | 394 bool eof = false; |
394 for (size_t i = 0; !eof; ++i) { | 395 for (size_t i = 0; !eof; ++i) { |
395 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); | 396 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); |
396 if (gpu_feature_info.disabled) { | 397 if (gpu_feature_info.disabled) { |
397 std::unique_ptr<base::DictionaryValue> problem( | 398 std::unique_ptr<base::DictionaryValue> problem( |
398 new base::DictionaryValue()); | 399 new base::DictionaryValue()); |
399 problem->SetString( | 400 problem->SetString( |
400 "description", gpu_feature_info.disabled_description); | 401 "description", gpu_feature_info.disabled_description); |
401 problem->Set("crBugs", new base::ListValue()); | 402 problem->Set("crBugs", new base::ListValue()); |
402 problem->Set("webkitBugs", new base::ListValue()); | 403 problem->Set("webkitBugs", new base::ListValue()); |
403 base::ListValue* disabled_features = new base::ListValue(); | 404 base::ListValue* disabled_features = new base::ListValue(); |
404 disabled_features->AppendString(gpu_feature_info.name); | 405 disabled_features->AppendString(gpu_feature_info.name); |
405 problem->Set("affectedGpuSettings", disabled_features); | 406 problem->Set("affectedGpuSettings", disabled_features); |
406 problem->SetString("tag", "disabledFeatures"); | 407 problem->SetString("tag", "disabledFeatures"); |
407 problem_list->Append(std::move(problem)); | 408 problem_list->Append(std::move(problem)); |
408 } | 409 } |
409 } | 410 } |
410 return problem_list; | 411 return problem_list; |
411 } | 412 } |
412 | 413 |
413 std::vector<std::string> GetDriverBugWorkarounds() { | 414 std::vector<std::string> GetDriverBugWorkarounds() { |
414 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); | 415 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); |
415 } | 416 } |
416 | 417 |
417 } // namespace content | 418 } // namespace content |
OLD | NEW |