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

Unified Diff: content/common/gpu/image_transport_surface_linux.cc

Issue 9192014: Replace WGC3D visibility extension with resource_usage extension. [Part 2 of 3] (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added image_transport_surface_win changes 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 | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/image_transport_surface_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/image_transport_surface_linux.cc
diff --git a/content/common/gpu/image_transport_surface_linux.cc b/content/common/gpu/image_transport_surface_linux.cc
index 28d560bc53b24b883311980bb3d47b2cddd0f88a..fca12556f159e4aec0881f54de88ef45f58a70ae 100644
--- a/content/common/gpu/image_transport_surface_linux.cc
+++ b/content/common/gpu/image_transport_surface_linux.cc
@@ -89,7 +89,7 @@ class EGLImageTransportSurface
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
- virtual void SetVisible(bool visible) OVERRIDE;
+ virtual void SetResourceUsage(ResourceUsage resourceUsage) OVERRIDE;
protected:
// ImageTransportSurface implementation
@@ -136,7 +136,7 @@ class GLXImageTransportSurface
virtual std::string GetExtensions();
virtual gfx::Size GetSize() OVERRIDE;
virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
- virtual void SetVisible(bool visible) OVERRIDE;
+ virtual void SetResourceUsage(ResourceUsage resourceUsage) OVERRIDE;
protected:
// ImageTransportSurface implementation:
@@ -318,12 +318,21 @@ unsigned int EGLImageTransportSurface::GetBackingFrameBufferObject() {
return fbo_id_;
}
-void EGLImageTransportSurface::SetVisible(bool visible) {
- if (!visible && back_surface_.get() && front_surface_.get()) {
- ReleaseSurface(&back_surface_);
- } else if (visible && !back_surface_.get() && front_surface_.get()) {
- // Leverage the OnResize hook because it does exactly what we want
- OnResize(front_surface_->size());
+void EGLImageTransportSurface::SetResourceUsage(ResourceUsage resourceUsage) {
+ switch (resourceUsage) {
+ case RESOURCE_USAGE_FULL:
+ if (!back_surface_.get() && front_surface_.get()) {
+ // Leverage the OnResize hook because it does exactly what we want
+ OnResize(front_surface_->size());
+ }
+ break;
+ case RESOURCE_USAGE_LESS:
+ if (back_surface_.get() && front_surface_.get())
+ ReleaseSurface(&back_surface_);
+ break;
+ case RESOURCE_USAGE_NONE:
+ // TODO(mmocny): drop all the buffers
+ break;
}
}
@@ -514,13 +523,19 @@ void GLXImageTransportSurface::ReleaseSurface() {
bound_ = false;
}
-void GLXImageTransportSurface::SetVisible(bool visible) {
+void GLXImageTransportSurface::SetResourceUsage(ResourceUsage resourceUsage) {
Display* dpy = static_cast<Display*>(GetDisplay());
- if (!visible) {
- XResizeWindow(dpy, window_, 1, 1);
- } else {
- XResizeWindow(dpy, window_, size_.width(), size_.height());
- needs_resize_ = true;
+ switch (resourceUsage) {
+ case RESOURCE_USAGE_FULL:
+ XResizeWindow(dpy, window_, size_.width(), size_.height());
+ needs_resize_ = true;
+ break;
+ case RESOURCE_USAGE_LESS:
+ XResizeWindow(dpy, window_, 1, 1);
+ break;
+ case RESOURCE_USAGE_NONE:
+ // TODO(mmocny): drop all the buffers
+ break;
}
glXWaitX();
}
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/image_transport_surface_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698