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

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

Issue 2891933004: Remove raw base::DictionaryValue::Set in //content (Closed)
Patch Set: Created 3 years, 7 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 285
287 if (command_line.HasSwitch(cc::switches::kDisableMainFrameBeforeActivation)) 286 if (command_line.HasSwitch(cc::switches::kDisableMainFrameBeforeActivation))
288 return false; 287 return false;
289 288
290 if (command_line.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation)) 289 if (command_line.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation))
291 return true; 290 return true;
292 291
293 return true; 292 return true;
294 } 293 }
295 294
296 base::DictionaryValue* GetFeatureStatus() { 295 std::unique_ptr<base::DictionaryValue> GetFeatureStatus() {
297 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 296 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
298 std::string gpu_access_blocked_reason; 297 std::string gpu_access_blocked_reason;
299 bool gpu_access_blocked = 298 bool gpu_access_blocked =
300 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); 299 !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
301 300
302 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); 301 auto feature_status_dict = base::MakeUnique<base::DictionaryValue>();
303 302
304 bool eof = false; 303 bool eof = false;
305 for (size_t i = 0; !eof; ++i) { 304 for (size_t i = 0; !eof; ++i) {
306 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); 305 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof);
307 std::string status; 306 std::string status;
308 if (gpu_feature_info.disabled) { 307 if (gpu_feature_info.disabled) {
309 status = "disabled"; 308 status = "disabled";
310 if (gpu_feature_info.fallback_to_software) 309 if (gpu_feature_info.fallback_to_software)
311 status += "_software"; 310 status += "_software";
312 else 311 else
(...skipping 27 matching lines...) Expand all
340 (gpu_feature_info.blocked || gpu_access_blocked) && 339 (gpu_feature_info.blocked || gpu_access_blocked) &&
341 manager->ShouldUseSwiftShader()) { 340 manager->ShouldUseSwiftShader()) {
342 status = "unavailable_software"; 341 status = "unavailable_software";
343 } 342 }
344 343
345 feature_status_dict->SetString(gpu_feature_info.name, status); 344 feature_status_dict->SetString(gpu_feature_info.name, status);
346 } 345 }
347 return feature_status_dict; 346 return feature_status_dict;
348 } 347 }
349 348
350 base::Value* GetProblems() { 349 std::unique_ptr<base::ListValue> GetProblems() {
351 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 350 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
352 std::string gpu_access_blocked_reason; 351 std::string gpu_access_blocked_reason;
353 bool gpu_access_blocked = 352 bool gpu_access_blocked =
354 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); 353 !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
355 354
356 base::ListValue* problem_list = new base::ListValue(); 355 auto problem_list = base::MakeUnique<base::ListValue>();
357 manager->GetBlacklistReasons(problem_list); 356 manager->GetBlacklistReasons(problem_list.get());
358 357
359 if (gpu_access_blocked) { 358 if (gpu_access_blocked) {
360 auto problem = base::MakeUnique<base::DictionaryValue>(); 359 auto problem = base::MakeUnique<base::DictionaryValue>();
361 problem->SetString("description", 360 problem->SetString("description",
362 "GPU process was unable to boot: " + gpu_access_blocked_reason); 361 "GPU process was unable to boot: " + gpu_access_blocked_reason);
363 problem->Set("crBugs", new base::ListValue()); 362 problem->Set("crBugs", base::MakeUnique<base::ListValue>());
364 base::ListValue* disabled_features = new base::ListValue(); 363 auto disabled_features = base::MakeUnique<base::ListValue>();
365 disabled_features->AppendString("all"); 364 disabled_features->AppendString("all");
366 problem->Set("affectedGpuSettings", disabled_features); 365 problem->Set("affectedGpuSettings", std::move(disabled_features));
367 problem->SetString("tag", "disabledFeatures"); 366 problem->SetString("tag", "disabledFeatures");
368 problem_list->Insert(0, std::move(problem)); 367 problem_list->Insert(0, std::move(problem));
369 } 368 }
370 369
371 bool eof = false; 370 bool eof = false;
372 for (size_t i = 0; !eof; ++i) { 371 for (size_t i = 0; !eof; ++i) {
373 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); 372 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof);
374 if (gpu_feature_info.disabled) { 373 if (gpu_feature_info.disabled) {
375 std::unique_ptr<base::DictionaryValue> problem( 374 auto problem = base::MakeUnique<base::DictionaryValue>();
376 new base::DictionaryValue());
377 problem->SetString( 375 problem->SetString(
378 "description", gpu_feature_info.disabled_description); 376 "description", gpu_feature_info.disabled_description);
379 problem->Set("crBugs", new base::ListValue()); 377 problem->Set("crBugs", base::MakeUnique<base::ListValue>());
380 base::ListValue* disabled_features = new base::ListValue(); 378 auto disabled_features = base::MakeUnique<base::ListValue>();
381 disabled_features->AppendString(gpu_feature_info.name); 379 disabled_features->AppendString(gpu_feature_info.name);
382 problem->Set("affectedGpuSettings", disabled_features); 380 problem->Set("affectedGpuSettings", std::move(disabled_features));
383 problem->SetString("tag", "disabledFeatures"); 381 problem->SetString("tag", "disabledFeatures");
384 problem_list->Append(std::move(problem)); 382 problem_list->Append(std::move(problem));
385 } 383 }
386 } 384 }
387 return problem_list; 385 return problem_list;
388 } 386 }
389 387
390 std::vector<std::string> GetDriverBugWorkarounds() { 388 std::vector<std::string> GetDriverBugWorkarounds() {
391 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 389 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
392 } 390 }
393 391
394 } // namespace content 392 } // 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