| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 if (compositing_iosurface_) { | 486 if (compositing_iosurface_) { |
| 487 if (!CreateCompositedIOSurfaceAndLayer()) { | 487 if (!CreateCompositedIOSurfaceAndLayer()) { |
| 488 LOG(ERROR) << "Failed to create CALayer for existing IOSurface"; | 488 LOG(ERROR) << "Failed to create CALayer for existing IOSurface"; |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 | 492 |
| 493 bool RenderWidgetHostViewMac::CreateCompositedIOSurfaceAndLayer() { | 493 bool RenderWidgetHostViewMac::CreateCompositedIOSurfaceAndLayer() { |
| 494 if (compositing_iosurface_layer_ && | 494 if (compositing_iosurface_layer_ && |
| 495 [compositing_iosurface_layer_ context] && | 495 [compositing_iosurface_layer_ context].get() && |
| 496 compositing_iosurface_) { | 496 compositing_iosurface_) { |
| 497 return true; | 497 return true; |
| 498 } | 498 } |
| 499 | 499 |
| 500 ScopedCAActionDisabler disabler; | 500 ScopedCAActionDisabler disabler; |
| 501 if (!compositing_iosurface_layer_) { | 501 if (!compositing_iosurface_layer_) { |
| 502 compositing_iosurface_layer_.reset([[CompositingIOSurfaceLayer alloc] | 502 compositing_iosurface_layer_.reset([[CompositingIOSurfaceLayer alloc] |
| 503 initWithRenderWidgetHostViewMac:this]); | 503 initWithRenderWidgetHostViewMac:this]); |
| 504 if (!compositing_iosurface_layer_) { | 504 if (!compositing_iosurface_layer_) { |
| 505 LOG(ERROR) << "Failed to create CALayer for IOSurface"; | 505 LOG(ERROR) << "Failed to create CALayer for IOSurface"; |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 void RenderWidgetHostViewMac::CopyFromCompositingSurfaceToVideoFrame( | 1096 void RenderWidgetHostViewMac::CopyFromCompositingSurfaceToVideoFrame( |
| 1097 const gfx::Rect& src_subrect, | 1097 const gfx::Rect& src_subrect, |
| 1098 const scoped_refptr<media::VideoFrame>& target, | 1098 const scoped_refptr<media::VideoFrame>& target, |
| 1099 const base::Callback<void(bool)>& callback) { | 1099 const base::Callback<void(bool)>& callback) { |
| 1100 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 1100 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 1101 if (!render_widget_host_->is_accelerated_compositing_active() || | 1101 if (!render_widget_host_->is_accelerated_compositing_active() || |
| 1102 !compositing_iosurface_ || | 1102 !compositing_iosurface_ || |
| 1103 !compositing_iosurface_->HasIOSurface()) | 1103 !compositing_iosurface_->HasIOSurface()) |
| 1104 return; | 1104 return; |
| 1105 | 1105 |
| 1106 if (!target) { | 1106 if (!target.get()) { |
| 1107 NOTREACHED(); | 1107 NOTREACHED(); |
| 1108 return; | 1108 return; |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 if (target->format() != media::VideoFrame::YV12 && | 1111 if (target->format() != media::VideoFrame::YV12 && |
| 1112 target->format() != media::VideoFrame::I420) { | 1112 target->format() != media::VideoFrame::I420) { |
| 1113 NOTREACHED(); | 1113 NOTREACHED(); |
| 1114 return; | 1114 return; |
| 1115 } | 1115 } |
| 1116 | 1116 |
| (...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3713 return YES; | 3713 return YES; |
| 3714 } | 3714 } |
| 3715 | 3715 |
| 3716 - (BOOL)isOpaque { | 3716 - (BOOL)isOpaque { |
| 3717 if (renderWidgetHostView_->use_core_animation_) | 3717 if (renderWidgetHostView_->use_core_animation_) |
| 3718 return YES; | 3718 return YES; |
| 3719 return [super isOpaque]; | 3719 return [super isOpaque]; |
| 3720 } | 3720 } |
| 3721 | 3721 |
| 3722 @end | 3722 @end |
| OLD | NEW |