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

Unified Diff: content/browser/compositor/io_surface_layer_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
Index: content/browser/compositor/io_surface_layer_mac.mm
diff --git a/content/browser/compositor/io_surface_layer_mac.mm b/content/browser/compositor/io_surface_layer_mac.mm
index f88298f6c7cba577f09a48d6bcf83e9c6b9dee19..d09f24c490265f8efda06d5898b603cc261706d1 100644
--- a/content/browser/compositor/io_surface_layer_mac.mm
+++ b/content/browser/compositor/io_surface_layer_mac.mm
@@ -174,7 +174,9 @@
helper_.reset(new content::IOSurfaceLayerHelper(client, self));
iosurface_ = content::IOSurfaceTexture::Create();
- if (!iosurface_.get()) {
+ context_ = content::IOSurfaceContext::Get(
+ content::IOSurfaceContext::kCALayerContext);
+ if (!iosurface_.get() || !context_.get()) {
LOG(ERROR) << "Failed create CompositingIOSurface or context";
[self resetClient];
[self release];
@@ -205,11 +207,11 @@
}
- (void)poisonContextAndSharegroup {
- iosurface_->context()->PoisonContextAndSharegroup();
+ context_->PoisonContextAndSharegroup();
}
- (bool)hasBeenPoisoned {
- return iosurface_->context()->HasBeenPoisoned();
+ return context_->HasBeenPoisoned();
}
- (float)scaleFactor {
@@ -220,7 +222,7 @@
- (int)rendererID {
GLint current_renderer_id = -1;
- if (CGLGetParameter(iosurface_->context()->cgl_context(),
+ if (CGLGetParameter(context_->cgl_context(),
kCGLCPCurrentRendererID,
&current_renderer_id) == kCGLNoError) {
return current_renderer_id & kCGLRendererIDMatchingMask;
@@ -255,12 +257,15 @@
// The remaining methods implement the CAOpenGLLayer interface.
- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask {
- return CGLRetainPixelFormat(
- CGLGetPixelFormat(iosurface_->context()->cgl_context()));
+ if (!context_.get())
+ return [super copyCGLPixelFormatForDisplayMask:mask];
+ return CGLRetainPixelFormat(CGLGetPixelFormat(context_->cgl_context()));
}
- (CGLContextObj)copyCGLContextForPixelFormat:(CGLPixelFormatObj)pixelFormat {
- return CGLRetainContext(iosurface_->context()->cgl_context());
+ if (!context_.get())
+ return [super copyCGLContextForPixelFormat:pixelFormat];
+ return CGLRetainContext(context_->cgl_context());
}
- (void)setNeedsDisplay {
« no previous file with comments | « content/browser/compositor/io_surface_layer_mac.h ('k') | content/browser/compositor/io_surface_texture_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698