summaryrefslogtreecommitdiffstats
path: root/ui/surface/accelerated_surface_win.h
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 14:24:48 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 14:24:48 +0000
commit87ee4a87f37e6470e0ad75aecddc9e97f6a6e41f (patch)
tree2d896de2f7ba8f900c18e97f027b17917f3b9d5b /ui/surface/accelerated_surface_win.h
parent2c061f5e9b6a605bdf5956fb6bb229f7afe906c5 (diff)
downloadchromium_src-87ee4a87f37e6470e0ad75aecddc9e97f6a6e41f.zip
chromium_src-87ee4a87f37e6470e0ad75aecddc9e97f6a6e41f.tar.gz
chromium_src-87ee4a87f37e6470e0ad75aecddc9e97f6a6e41f.tar.bz2
Move readback to present thread.
Eliminates blocking of main thread when readback is happening every frame, as can happen when tab capture is enabled. BUG=145587 TEST=Run chrome with tab capture extension enabled, verify using about:tracing that main thread doesn't have long blocks waiting on the present mutex. Review URL: https://chromiumcodereview.appspot.com/11410043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/surface/accelerated_surface_win.h')
-rw-r--r--ui/surface/accelerated_surface_win.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/ui/surface/accelerated_surface_win.h b/ui/surface/accelerated_surface_win.h
index 5fc3de0..166bf5b 100644
--- a/ui/surface/accelerated_surface_win.h
+++ b/ui/surface/accelerated_surface_win.h
@@ -9,6 +9,7 @@
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/win/scoped_comptr.h"
@@ -58,9 +59,10 @@ class SURFACE_EXPORT AcceleratedPresenter
// The public member functions are called on the main thread.
void Present(HDC dc);
- bool CopyTo(const gfx::Rect& src_subrect,
- const gfx::Size& dst_size,
- void* buf);
+ void AsyncCopyTo(const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ void* buf,
+ const base::Callback<void(bool)>& callback);
void Invalidate();
#if defined(USE_AURA)
@@ -83,6 +85,15 @@ class SURFACE_EXPORT AcceleratedPresenter
void DoSuspend();
void DoPresent(const base::Closure& composite_task);
void DoReleaseSurface();
+ void DoCopyToAndAcknowledge(
+ const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ void* buf,
+ scoped_refptr<base::SingleThreadTaskRunner> callback_runner,
+ const base::Callback<void(bool)>& callback);
+ bool DoCopyTo(const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ void* buf);
void PresentWithGDI(HDC dc);
gfx::Size GetWindowSize();
@@ -151,9 +162,10 @@ class SURFACE_EXPORT AcceleratedSurface {
// |dst_size|.
// Caller must ensure that |buf| is allocated with the size no less than
// |4 * dst_size.width() * dst_size.height()| bytes.
- bool CopyTo(const gfx::Rect& src_subrect,
- const gfx::Size& dst_size,
- void* buf);
+ void AsyncCopyTo(const gfx::Rect& src_subrect,
+ const gfx::Size& dst_size,
+ void* buf,
+ const base::Callback<void(bool)>& callback);
// Temporarily release resources until a new surface is asynchronously
// presented. Present will not be able to represent the last surface after