| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
| 9 | 9 |
| 10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
| 11 #include "content/browser/renderer_host/render_widget_host_impl.h" | 11 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 12 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 12 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 13 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" | 13 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" |
| 14 #include "content/browser/renderer_host/compositing_iosurface_mac.h" | 14 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
| 15 #include "ui/base/cocoa/animation_utils.h" | 15 #include "ui/base/cocoa/animation_utils.h" |
| 16 #include "ui/gfx/size_conversions.h" | 16 #include "ui/gfx/size_conversions.h" |
| 17 #include "ui/gl/gpu_switching_manager.h" | 17 #include "ui/gl/gpu_switching_manager.h" |
| 18 | 18 |
| 19 @implementation CompositingIOSurfaceLayer | 19 @implementation CompositingIOSurfaceLayer |
| 20 | 20 |
| 21 @synthesize context = context_; | 21 @synthesize context = context_; |
| 22 | 22 |
| 23 - (id)initWithRenderWidgetHostViewMac:(content::RenderWidgetHostViewMac*)r { | 23 - (id)initWithRenderWidgetHostViewMac:(content::RenderWidgetHostViewMac*)r { |
| 24 if (self = [super init]) { | 24 if (self = [super init]) { |
| 25 renderWidgetHostView_ = r; | 25 renderWidgetHostView_ = r; |
| 26 context_ = content::CompositingIOSurfaceContext::Get( | 26 context_ = content::CompositingIOSurfaceContext::Get( |
| 27 content::CompositingIOSurfaceContext::kOffscreenContextWindowNumber); | 27 content::CompositingIOSurfaceContext::kCALayerContextWindowNumber); |
| 28 DCHECK(context_); | 28 DCHECK(context_); |
| 29 needsDisplay_ = NO; | 29 needsDisplay_ = NO; |
| 30 | 30 |
| 31 ScopedCAActionDisabler disabler; | 31 ScopedCAActionDisabler disabler; |
| 32 [self setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; | 32 [self setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; |
| 33 [self setContentsGravity:kCAGravityTopLeft]; | 33 [self setContentsGravity:kCAGravityTopLeft]; |
| 34 [self setFrame:NSRectToCGRect( | 34 [self setFrame:NSRectToCGRect( |
| 35 [renderWidgetHostView_->cocoa_view() bounds])]; | 35 [renderWidgetHostView_->cocoa_view() bounds])]; |
| 36 if ([self respondsToSelector:(@selector(setContentsScale:))]) { | 36 if ([self respondsToSelector:(@selector(setContentsScale:))]) { |
| 37 [self setContentsScale: | 37 [self setContentsScale: |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 false)) { | 155 false)) { |
| 156 renderWidgetHostView_->GotAcceleratedCompositingError(); | 156 renderWidgetHostView_->GotAcceleratedCompositingError(); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 | 159 |
| 160 needsDisplay_ = NO; | 160 needsDisplay_ = NO; |
| 161 renderWidgetHostView_->SendPendingLatencyInfoToHost(); | 161 renderWidgetHostView_->SendPendingLatencyInfoToHost(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 @end | 164 @end |
| OLD | NEW |