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

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

Issue 647553002: Revert of Use a single CGLContextObj to draw and update the IOSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 545791e13140c39e8fd023d7060d0a8a91c2ddf9..dea6b2876828f0d477ab96ebc989fa0985a5341b 100644
--- a/content/browser/compositor/io_surface_texture_mac.mm
+++ b/content/browser/compositor/io_surface_texture_mac.mm
@@ -35,28 +35,30 @@
// static
scoped_refptr<IOSurfaceTexture> IOSurfaceTexture::Create() {
- scoped_refptr<IOSurfaceContext> context = IOSurfaceContext::Get();
- if (!context.get()) {
+ scoped_refptr<IOSurfaceContext> offscreen_context =
+ IOSurfaceContext::Get(
+ IOSurfaceContext::kOffscreenContext);
+ if (!offscreen_context.get()) {
LOG(ERROR) << "Failed to create context for offscreen operations";
return NULL;
}
- return new IOSurfaceTexture(context);
+ return new IOSurfaceTexture(offscreen_context);
}
IOSurfaceTexture::IOSurfaceTexture(
- const scoped_refptr<IOSurfaceContext>& context)
- : context_(context),
+ const scoped_refptr<IOSurfaceContext>& offscreen_context)
+ : offscreen_context_(offscreen_context),
texture_(0),
gl_error_(GL_NO_ERROR),
eviction_queue_iterator_(eviction_queue_.Get().end()),
eviction_has_been_drawn_since_updated_(false) {
- CHECK(context_.get());
+ CHECK(offscreen_context_.get());
}
IOSurfaceTexture::~IOSurfaceTexture() {
ReleaseIOSurfaceAndTexture();
- context_ = NULL;
+ offscreen_context_ = NULL;
DCHECK(eviction_queue_iterator_ == eviction_queue_.Get().end());
}
@@ -172,7 +174,7 @@
CGLError cgl_error = kCGLNoError;
{
gfx::ScopedCGLSetCurrentContext scoped_set_current_context(
- context_->cgl_context());
+ offscreen_context_->cgl_context());
glGenTextures(1, &texture_);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture_);
glTexParameterf(
@@ -180,7 +182,7 @@
glTexParameterf(
GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
cgl_error = CGLTexImageIOSurface2D(
- context_->cgl_context(),
+ offscreen_context_->cgl_context(),
GL_TEXTURE_RECTANGLE_ARB,
GL_RGBA,
rounded_size.width(),
@@ -209,7 +211,7 @@
void IOSurfaceTexture::ReleaseIOSurfaceAndTexture() {
gfx::ScopedCGLSetCurrentContext scoped_set_current_context(
- context_->cgl_context());
+ offscreen_context_->cgl_context());
if (texture_) {
glDeleteTextures(1, &texture_);
@@ -219,6 +221,10 @@
io_surface_.reset();
EvictionMarkEvicted();
+}
+
+bool IOSurfaceTexture::HasBeenPoisoned() const {
+ return offscreen_context_->HasBeenPoisoned();
}
GLenum IOSurfaceTexture::GetAndSaveGLError() {
« 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