diff options
author | junov@google.com <junov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 20:12:46 +0000 |
---|---|---|
committer | junov@google.com <junov@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 20:12:46 +0000 |
commit | 0d96496a51bc02e67c53802f18e106659f336cab (patch) | |
tree | 480d91bb30a368228cc7c01ac3227f7dfa44e579 /ui/gfx/surface | |
parent | 926a4bd098fd0090c78343c80d6f913b9a97f3b9 (diff) | |
download | chromium_src-0d96496a51bc02e67c53802f18e106659f336cab.zip chromium_src-0d96496a51bc02e67c53802f18e106659f336cab.tar.gz chromium_src-0d96496a51bc02e67c53802f18e106659f336cab.tar.bz2 |
Adding command line switch --gpu-swap-delay to artificially slow down the
GPU process to simulate slow GPUs.
BUG=120469
TEST=None
Review URL: https://chromiumcodereview.appspot.com/9866053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/surface')
-rw-r--r-- | ui/gfx/surface/accelerated_surface_win.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/gfx/surface/accelerated_surface_win.cc b/ui/gfx/surface/accelerated_surface_win.cc index f2a05bd..c1f0c66 100644 --- a/ui/gfx/surface/accelerated_surface_win.cc +++ b/ui/gfx/surface/accelerated_surface_win.cc @@ -11,6 +11,8 @@ #include "base/bind_helpers.h" #include "base/callback.h" #include "base/command_line.h" +#include "base/string_number_conversions.h" +#include "base/time.h" #include "base/debug/trace_event.h" #include "base/file_path.h" #include "base/lazy_instance.h" @@ -476,6 +478,16 @@ void AcceleratedPresenter::Invalidate() { AcceleratedPresenter::~AcceleratedPresenter() { } +static base::TimeDelta GetSwapDelay() { + CommandLine* cmd_line = CommandLine::ForCurrentProcess(); + int delay = 0; + if (cmd_line->HasSwitch(switches::kGpuSwapDelay)) { + base::StringToInt(cmd_line->GetSwitchValueNative( + switches::kGpuSwapDelay).c_str(), &delay); + } + return base::TimeDelta::FromMilliseconds(delay); +} + void AcceleratedPresenter::DoPresentAndAcknowledge( const gfx::Size& size, int64 surface_handle, @@ -609,6 +621,10 @@ void AcceleratedPresenter::DoPresentAndAcknowledge( } while (hr == S_FALSE); } + static const base::TimeDelta swap_delay = GetSwapDelay(); + if (swap_delay.ToInternalValue()) + base::PlatformThread::Sleep(swap_delay); + scoped_completion_runner.Release(); if (!completion_task.is_null()) completion_task.Run(true); |