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

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

Issue 2891933004: Remove raw base::DictionaryValue::Set in //content (Closed)
Patch Set: Rebase Created 3 years, 6 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 | « content/browser/gpu/compositor_util.h ('k') | content/browser/gpu/gpu_data_manager_impl.h » ('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) 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>
10 #include <utility> 9 #include <utility>
11 10
12 #include "base/command_line.h" 11 #include "base/command_line.h"
13 #include "base/feature_list.h" 12 #include "base/feature_list.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
17 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
18 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
19 #include "base/sys_info.h" 18 #include "base/sys_info.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 287 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
289 cc::switches::kEnableCheckerImaging)) 288 cc::switches::kEnableCheckerImaging))
290 return true; 289 return true;
291 290
292 if (base::FeatureList::IsEnabled(features::kCheckerImaging)) 291 if (base::FeatureList::IsEnabled(features::kCheckerImaging))
293 return true; 292 return true;
294 293
295 return false; 294 return false;
296 } 295 }
297 296
298 base::DictionaryValue* GetFeatureStatus() { 297 std::unique_ptr<base::DictionaryValue> GetFeatureStatus() {
299 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 298 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
300 std::string gpu_access_blocked_reason; 299 std::string gpu_access_blocked_reason;
301 bool gpu_access_blocked = 300 bool gpu_access_blocked =
302 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); 301 !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
303 302
304 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); 303 auto feature_status_dict = base::MakeUnique<base::DictionaryValue>();
305 304
306 bool eof = false; 305 bool eof = false;
307 for (size_t i = 0; !eof; ++i) { 306 for (size_t i = 0; !eof; ++i) {
308 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); 307 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof);
309 std::string status; 308 std::string status;
310 if (gpu_feature_info.disabled) { 309 if (gpu_feature_info.disabled) {
311 status = "disabled"; 310 status = "disabled";
312 if (gpu_feature_info.fallback_to_software) 311 if (gpu_feature_info.fallback_to_software)
313 status += "_software"; 312 status += "_software";
314 else 313 else
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 (gpu_feature_info.blocked || gpu_access_blocked) && 348 (gpu_feature_info.blocked || gpu_access_blocked) &&
350 manager->ShouldUseSwiftShader()) { 349 manager->ShouldUseSwiftShader()) {
351 status = "unavailable_software"; 350 status = "unavailable_software";
352 } 351 }
353 352
354 feature_status_dict->SetString(gpu_feature_info.name, status); 353 feature_status_dict->SetString(gpu_feature_info.name, status);
355 } 354 }
356 return feature_status_dict; 355 return feature_status_dict;
357 } 356 }
358 357
359 base::Value* GetProblems() { 358 std::unique_ptr<base::ListValue> GetProblems() {
360 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 359 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
361 std::string gpu_access_blocked_reason; 360 std::string gpu_access_blocked_reason;
362 bool gpu_access_blocked = 361 bool gpu_access_blocked =
363 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); 362 !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
364 363
365 base::ListValue* problem_list = new base::ListValue(); 364 auto problem_list = base::MakeUnique<base::ListValue>();
366 manager->GetBlacklistReasons(problem_list); 365 manager->GetBlacklistReasons(problem_list.get());
367 366
368 if (gpu_access_blocked) { 367 if (gpu_access_blocked) {
369 auto problem = base::MakeUnique<base::DictionaryValue>(); 368 auto problem = base::MakeUnique<base::DictionaryValue>();
370 problem->SetString("description", 369 problem->SetString("description",
371 "GPU process was unable to boot: " + gpu_access_blocked_reason); 370 "GPU process was unable to boot: " + gpu_access_blocked_reason);
372 problem->Set("crBugs", new base::ListValue()); 371 problem->Set("crBugs", base::MakeUnique<base::ListValue>());
373 base::ListValue* disabled_features = new base::ListValue(); 372 auto disabled_features = base::MakeUnique<base::ListValue>();
374 disabled_features->AppendString("all"); 373 disabled_features->AppendString("all");
375 problem->Set("affectedGpuSettings", disabled_features); 374 problem->Set("affectedGpuSettings", std::move(disabled_features));
376 problem->SetString("tag", "disabledFeatures"); 375 problem->SetString("tag", "disabledFeatures");
377 problem_list->Insert(0, std::move(problem)); 376 problem_list->Insert(0, std::move(problem));
378 } 377 }
379 378
380 bool eof = false; 379 bool eof = false;
381 for (size_t i = 0; !eof; ++i) { 380 for (size_t i = 0; !eof; ++i) {
382 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); 381 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof);
383 if (gpu_feature_info.disabled) { 382 if (gpu_feature_info.disabled) {
384 std::unique_ptr<base::DictionaryValue> problem( 383 auto problem = base::MakeUnique<base::DictionaryValue>();
385 new base::DictionaryValue());
386 problem->SetString( 384 problem->SetString(
387 "description", gpu_feature_info.disabled_description); 385 "description", gpu_feature_info.disabled_description);
388 problem->Set("crBugs", new base::ListValue()); 386 problem->Set("crBugs", base::MakeUnique<base::ListValue>());
389 base::ListValue* disabled_features = new base::ListValue(); 387 auto disabled_features = base::MakeUnique<base::ListValue>();
390 disabled_features->AppendString(gpu_feature_info.name); 388 disabled_features->AppendString(gpu_feature_info.name);
391 problem->Set("affectedGpuSettings", disabled_features); 389 problem->Set("affectedGpuSettings", std::move(disabled_features));
392 problem->SetString("tag", "disabledFeatures"); 390 problem->SetString("tag", "disabledFeatures");
393 problem_list->Append(std::move(problem)); 391 problem_list->Append(std::move(problem));
394 } 392 }
395 } 393 }
396 return problem_list; 394 return problem_list;
397 } 395 }
398 396
399 std::vector<std::string> GetDriverBugWorkarounds() { 397 std::vector<std::string> GetDriverBugWorkarounds() {
400 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 398 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
401 } 399 }
402 400
403 } // namespace content 401 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/compositor_util.h ('k') | content/browser/gpu/gpu_data_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698