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

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

Issue 10908110: Move gpu blacklist to content side. (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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chrome_gpu_util.h"
6
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h"
10 #include "base/version.h"
11 #if defined(OS_WIN)
12 #include "base/win/windows_version.h"
13 #endif
14 #include "chrome/common/chrome_version_info.h"
15 #include "content/public/browser/gpu_data_manager.h"
16 #include "content/public/common/content_constants.h"
17 #include "content/public/common/content_switches.h"
18
19 using content::GpuDataManager;
20
21 namespace gpu_util {
22
23 void InitializeCompositingFieldTrial() {
24 // Enable the field trial only on desktop OS's.
25 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX))
26 return;
27 #endif
28 #if defined(OS_WIN)
29 // Don't run the trial on Windows XP.
30 if (base::win::GetVersion() < base::win::VERSION_VISTA)
31 return;
32 #endif
33
34 // The performance of accelerated compositing is too low with software
35 // rendering.
36 if (content::GpuDataManager::GetInstance()->ShouldUseSoftwareRendering())
37 return;
38
39 // Don't activate the field trial if force-compositing-mode has been
40 // explicitly disabled from the command line.
41 if (CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kDisableForceCompositingMode))
43 return;
44
45 const base::FieldTrial::Probability kDivisor = 3;
46 scoped_refptr<base::FieldTrial> trial(
47 base::FieldTrialList::FactoryGetFieldTrial(
48 content::kGpuCompositingFieldTrialName, kDivisor,
49 "disable", 2012, 12, 31, NULL));
50
51 // Produce the same result on every run of this client.
52 trial->UseOneTimeRandomization();
53
54 base::FieldTrial::Probability force_compositing_mode_probability = 0;
55 base::FieldTrial::Probability threaded_compositing_probability = 0;
56
57 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
58 if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
59 channel == chrome::VersionInfo::CHANNEL_BETA) {
60 // Stable and Beta channels: Non-threaded force-compositing-mode on by
61 // default (mac and windows only).
62 #if defined(OS_WIN) || defined(OS_MACOSX)
63 force_compositing_mode_probability = 3;
64 #endif
65 } else if (channel == chrome::VersionInfo::CHANNEL_DEV ||
66 channel == chrome::VersionInfo::CHANNEL_CANARY) {
67 // Dev and Canary channels: force-compositing-mode and
68 // threaded-compositing on with 1/3 probability each.
69 force_compositing_mode_probability = 1;
70
71 #if defined(OS_MACOSX) || defined(OS_LINUX)
72 // Threaded compositing mode isn't feature complete on mac or linux yet:
73 // http://crbug.com/133602 for mac
74 // http://crbug.com/140866 for linux
75 threaded_compositing_probability = 0;
76 #else
77 if (!CommandLine::ForCurrentProcess()->HasSwitch(
78 switches::kDisableThreadedCompositing))
79 threaded_compositing_probability = 1;
80 #endif
81 }
82
83
84 int force_compositing_group = trial->AppendGroup(
85 content::kGpuCompositingFieldTrialForceCompositingEnabledName,
86 force_compositing_mode_probability);
87 int thread_group = trial->AppendGroup(
88 content::kGpuCompositingFieldTrialThreadEnabledName,
89 threaded_compositing_probability);
90
91 bool force_compositing = (trial->group() == force_compositing_group);
92 bool thread = (trial->group() == thread_group);
93 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial",
94 force_compositing);
95 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread);
96 }
97
98 } // namespace gpu_util;
99
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698