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

Unified Diff: content/browser/compositor/io_surface_texture_mac.mm

Issue 627003002: Use a single CGLContextObj to draw and update the IOSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 2 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/browser/compositor/io_surface_texture_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/io_surface_texture_mac.mm
diff --git a/content/browser/compositor/io_surface_texture_mac.mm b/content/browser/compositor/io_surface_texture_mac.mm
index dea6b2876828f0d477ab96ebc989fa0985a5341b..545791e13140c39e8fd023d7060d0a8a91c2ddf9 100644
--- a/content/browser/compositor/io_surface_texture_mac.mm
+++ b/content/browser/compositor/io_surface_texture_mac.mm
@@ -35,30 +35,28 @@ namespace content {
// static
scoped_refptr<IOSurfaceTexture> IOSurfaceTexture::Create() {
- scoped_refptr<IOSurfaceContext> offscreen_context =
- IOSurfaceContext::Get(
- IOSurfaceContext::kOffscreenContext);
- if (!offscreen_context.get()) {
+ scoped_refptr<IOSurfaceContext> context = IOSurfaceContext::Get();
+ if (!context.get()) {
LOG(ERROR) << "Failed to create context for offscreen operations";
return NULL;
}
- return new IOSurfaceTexture(offscreen_context);
+ return new IOSurfaceTexture(context);
}
IOSurfaceTexture::IOSurfaceTexture(
- const scoped_refptr<IOSurfaceContext>& offscreen_context)
- : offscreen_context_(offscreen_context),
+ const scoped_refptr<IOSurfaceContext>& context)
+ : context_(context),
texture_(0),
gl_error_(GL_NO_ERROR),
eviction_queue_iterator_(eviction_queue_.Get().end()),
eviction_has_been_drawn_since_updated_(false) {
- CHECK(offscreen_context_.get());
+ CHECK(context_.get());
}
IOSurfaceTexture::~IOSurfaceTexture() {
ReleaseIOSurfaceAndTexture();
- offscreen_context_ = NULL;
+ context_ = NULL;
DCHECK(eviction_queue_iterator_ == eviction_queue_.Get().end());
}
@@ -174,7 +172,7 @@ bool IOSurfaceTexture::SetIOSurface(
CGLError cgl_error = kCGLNoError;
{
gfx::ScopedCGLSetCurrentContext scoped_set_current_context(
- offscreen_context_->cgl_context());
+ context_->cgl_context());
glGenTextures(1, &texture_);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture_);
glTexParameterf(
@@ -182,7 +180,7 @@ bool IOSurfaceTexture::SetIOSurface(
glTexParameterf(
GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
cgl_error = CGLTexImageIOSurface2D(
- offscreen_context_->cgl_context(),
+ context_->cgl_context(),
GL_TEXTURE_RECTANGLE_ARB,
GL_RGBA,
rounded_size.width(),
@@ -211,7 +209,7 @@ bool IOSurfaceTexture::SetIOSurface(
void IOSurfaceTexture::ReleaseIOSurfaceAndTexture() {
gfx::ScopedCGLSetCurrentContext scoped_set_current_context(
- offscreen_context_->cgl_context());
+ context_->cgl_context());
if (texture_) {
glDeleteTextures(1, &texture_);
@@ -223,10 +221,6 @@ void IOSurfaceTexture::ReleaseIOSurfaceAndTexture() {
EvictionMarkEvicted();
}
-bool IOSurfaceTexture::HasBeenPoisoned() const {
- return offscreen_context_->HasBeenPoisoned();
-}
-
GLenum IOSurfaceTexture::GetAndSaveGLError() {
GLenum gl_error = glGetError();
if (gl_error_ == GL_NO_ERROR)
« no previous file with comments | « content/browser/compositor/io_surface_texture_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698