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

Side by Side Diff: chrome/browser/gpu_util.cc

Issue 10891013: Make GpuDataManager thread safe. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 "chrome/browser/gpu_util.h" 5 #include "chrome/browser/gpu_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (!matches.size()) 291 if (!matches.size())
292 matches.push_back(kGpuFeatureNameUnknown); 292 matches.push_back(kGpuFeatureNameUnknown);
293 } 293 }
294 return JoinString(matches, ','); 294 return JoinString(matches, ',');
295 } 295 }
296 296
297 Value* GetFeatureStatus() { 297 Value* GetFeatureStatus() {
298 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 298 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
299 bool gpu_access_blocked = !GpuDataManager::GetInstance()->GpuAccessAllowed(); 299 bool gpu_access_blocked = !GpuDataManager::GetInstance()->GpuAccessAllowed();
300 300
301 uint32 flags = GpuDataManager::GetInstance()->GetGpuFeatureType(); 301 uint32 flags = GpuDataManager::GetInstance()->GetBlacklistedFeatures();
302 DictionaryValue* status = new DictionaryValue(); 302 DictionaryValue* status = new DictionaryValue();
303 303
304 const GpuFeatureInfo kGpuFeatureInfo[] = { 304 const GpuFeatureInfo kGpuFeatureInfo[] = {
305 { 305 {
306 "2d_canvas", 306 "2d_canvas",
307 flags & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, 307 flags & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS,
308 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || 308 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) ||
309 !SupportsAccelerated2dCanvas(), 309 !SupportsAccelerated2dCanvas(),
310 "Accelerated 2D canvas is unavailable: either disabled at the command" 310 "Accelerated 2D canvas is unavailable: either disabled at the command"
311 " line or not supported by the current system.", 311 " line or not supported by the current system.",
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 542
543 void UpdateStats() { 543 void UpdateStats() {
544 GpuBlacklist* blacklist = GpuBlacklist::GetInstance(); 544 GpuBlacklist* blacklist = GpuBlacklist::GetInstance();
545 uint32 max_entry_id = blacklist->max_entry_id(); 545 uint32 max_entry_id = blacklist->max_entry_id();
546 if (max_entry_id == 0) { 546 if (max_entry_id == 0) {
547 // GPU Blacklist was not loaded. No need to go further. 547 // GPU Blacklist was not loaded. No need to go further.
548 return; 548 return;
549 } 549 }
550 550
551 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 551 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
552 uint32 flags = GpuDataManager::GetInstance()->GetGpuFeatureType(); 552 uint32 flags = GpuDataManager::GetInstance()->GetBlacklistedFeatures();
553 bool disabled = false; 553 bool disabled = false;
554 if (flags == 0) { 554 if (flags == 0) {
555 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry", 555 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
556 0, max_entry_id + 1); 556 0, max_entry_id + 1);
557 } else { 557 } else {
558 std::vector<uint32> flag_entries; 558 std::vector<uint32> flag_entries;
559 blacklist->GetGpuFeatureTypeEntries( 559 blacklist->GetGpuFeatureTypeEntries(
560 content::GPU_FEATURE_TYPE_ALL, flag_entries, disabled); 560 content::GPU_FEATURE_TYPE_ALL, flag_entries, disabled);
561 DCHECK_GT(flag_entries.size(), 0u); 561 DCHECK_GT(flag_entries.size(), 0u);
562 for (size_t i = 0; i < flag_entries.size(); ++i) { 562 for (size_t i = 0; i < flag_entries.size(); ++i) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 kGpuBlacklistFeatureHistogramNamesWin[i], 622 kGpuBlacklistFeatureHistogramNamesWin[i],
623 1, kNumWinSubVersions * kGpuFeatureNumStatus, 623 1, kNumWinSubVersions * kGpuFeatureNumStatus,
624 kNumWinSubVersions * kGpuFeatureNumStatus + 1, 624 kNumWinSubVersions * kGpuFeatureNumStatus + 1,
625 base::Histogram::kUmaTargetedHistogramFlag); 625 base::Histogram::kUmaTargetedHistogramFlag);
626 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); 626 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
627 #endif 627 #endif
628 } 628 }
629 } 629 }
630 630
631 } // namespace gpu_util; 631 } // namespace gpu_util;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698