diff options
author | tomhudson@chromium.org <tomhudson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-28 12:17:10 +0000 |
---|---|---|
committer | tomhudson@chromium.org <tomhudson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-28 12:17:10 +0000 |
commit | 2be4b892681dc051cc8be10b5368e79277a3a88a (patch) | |
tree | c135c1f763811811e5536ddf4beb04f6282fa0ff /cc/base/switches.cc | |
parent | bcaa7d6f529da7400eae902babffaaeef48ddb54 (diff) | |
download | chromium_src-2be4b892681dc051cc8be10b5368e79277a3a88a.zip chromium_src-2be4b892681dc051cc8be10b5368e79277a3a88a.tar.gz chromium_src-2be4b892681dc051cc8be10b5368e79277a3a88a.tar.bz2 |
Remember value of IsImplSidePaintingEnabled
Command line arguments are constant at runtime, but the function
cc::switches::IsImplSidePaintingEnabled() does two searches through
the list of arguments every time it's called, and it's called every
time we record a SkPicture.
With this patch, the function remembers the value determined by the
first call and avoids repeating the searches on subsequent calls.
BUG=311248
R=nduca@chromium.org,skyostil@chromium.org
Review URL: https://codereview.chromium.org/43463003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/base/switches.cc')
-rw-r--r-- | cc/base/switches.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cc/base/switches.cc b/cc/base/switches.cc index 5dbb296..2eab547 100644 --- a/cc/base/switches.cc +++ b/cc/base/switches.cc @@ -162,7 +162,8 @@ bool IsLCDTextEnabled() { #endif } -bool IsImplSidePaintingEnabled() { +namespace { +bool CheckImplSidePaintingStatus() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(cc::switches::kDisableImplSidePainting)) @@ -176,6 +177,12 @@ bool IsImplSidePaintingEnabled() { return false; #endif } +} // namespace + +bool IsImplSidePaintingEnabled() { + static bool enabled = CheckImplSidePaintingStatus(); + return enabled; +} bool IsMapImageEnabled() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |