summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorjunov@google.com <junov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-29 20:12:46 +0000
committerjunov@google.com <junov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-29 20:12:46 +0000
commit0d96496a51bc02e67c53802f18e106659f336cab (patch)
tree480d91bb30a368228cc7c01ac3227f7dfa44e579 /ui
parent926a4bd098fd0090c78343c80d6f913b9a97f3b9 (diff)
downloadchromium_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')
-rw-r--r--ui/gfx/gl/gl_switches.cc4
-rw-r--r--ui/gfx/gl/gl_switches.h1
-rw-r--r--ui/gfx/surface/accelerated_surface_win.cc16
3 files changed, 21 insertions, 0 deletions
diff --git a/ui/gfx/gl/gl_switches.cc b/ui/gfx/gl/gl_switches.cc
index 38828f3..4614989 100644
--- a/ui/gfx/gl/gl_switches.cc
+++ b/ui/gfx/gl/gl_switches.cc
@@ -39,6 +39,10 @@ const char kSwiftShaderPath[] = "swiftshader-path";
// context will never be lost in any situations, say, a GPU reset.
const char kGpuNoContextLost[] = "gpu-no-context-lost";
+// Add a delay in milliseconds to the gpu swap buffer completion signal.
+// Simulates a slow GPU.
+const char kGpuSwapDelay[] = "gpu-swap-delay";
+
// Flag used for Linux tests: for desktop GL bindings, try to load this GL
// library first, but fall back to regular library if loading fails.
const char kTestGLLib[] = "test-gl-lib";
diff --git a/ui/gfx/gl/gl_switches.h b/ui/gfx/gl/gl_switches.h
index 6f4460e..7dc2dc8b 100644
--- a/ui/gfx/gl/gl_switches.h
+++ b/ui/gfx/gl/gl_switches.h
@@ -28,6 +28,7 @@ GL_EXPORT extern const char kDisableGpuVsync[];
GL_EXPORT extern const char kEnableGPUServiceLogging[];
GL_EXPORT extern const char kEnableGPUClientLogging[];
GL_EXPORT extern const char kGpuNoContextLost[];
+GL_EXPORT extern const char kGpuSwapDelay[];
GL_EXPORT extern const char kUseGL[];
GL_EXPORT extern const char kSwiftShaderPath[];
GL_EXPORT extern const char kTestGLLib[];
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);