Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: ui/gfx/surface/accelerated_surface_win.cc

Issue 9303009: Add IPC allowing GPU process to tell browser process to temporarily drop a front buffer. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/surface/accelerated_surface_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/surface/accelerated_surface_win.cc
===================================================================
--- ui/gfx/surface/accelerated_surface_win.cc (revision 119674)
+++ ui/gfx/surface/accelerated_surface_win.cc (working copy)
@@ -122,6 +122,10 @@
const int thread_affinity_;
base::ScopedNativeLibrary d3d_module_;
+ // Whether the presenter is suspended and therefore unable to represent. Only
+ // accessed on the UI thread so the lock is unnecessary.
+ bool suspended_;
+
// The size of the swap chain once any pending resizes have been processed.
// Only accessed on the UI thread so the lock is unnecessary.
gfx::Size pending_size_;
@@ -151,6 +155,7 @@
AcceleratedPresenter::AcceleratedPresenter()
: thread_affinity_(g_present_thread_pool.Pointer()->NextThread()),
+ suspended_(true),
num_pending_resizes_(0) {
g_present_thread_pool.Pointer()->PostTask(
thread_affinity_,
@@ -196,6 +201,8 @@
size,
surface_id,
completion_task));
+
+ suspended_ = false;
}
bool AcceleratedPresenter::Present(gfx::NativeWindow window) {
@@ -203,6 +210,9 @@
HRESULT hr;
+ if (suspended_)
+ return false;
+
base::AutoLock locked(lock_);
if (!device_)
@@ -265,6 +275,8 @@
base::Bind(&AcceleratedPresenter::DoResize,
base::Unretained(this),
gfx::Size(1, 1)));
+
+ suspended_ = true;
}
void AcceleratedPresenter::DoInitialize() {
@@ -499,3 +511,8 @@
bool AcceleratedSurface::Present(HWND window) {
return presenter_->Present(window);
}
+
+void AcceleratedSurface::Suspend() {
+ presenter_->Suspend();
+}
+
« no previous file with comments | « ui/gfx/surface/accelerated_surface_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698