summaryrefslogtreecommitdiffstats
path: root/ui/gfx/surface
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gfx/surface')
-rw-r--r--ui/gfx/surface/accelerated_surface_win.cc16
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);