| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/child_frame_compositing_helper.h" | 5 #include "content/renderer/child_frame_compositing_helper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "cc/blink/web_layer_impl.h" | 9 #include "cc/blink/web_layer_impl.h" |
| 10 #include "cc/layers/layer_settings.h" |
| 10 #include "cc/layers/solid_color_layer.h" | 11 #include "cc/layers/solid_color_layer.h" |
| 11 #include "cc/layers/surface_layer.h" | 12 #include "cc/layers/surface_layer.h" |
| 12 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 13 #include "cc/output/copy_output_request.h" | 14 #include "cc/output/copy_output_request.h" |
| 14 #include "cc/output/copy_output_result.h" | 15 #include "cc/output/copy_output_result.h" |
| 15 #include "cc/resources/single_release_callback.h" | 16 #include "cc/resources/single_release_callback.h" |
| 16 #include "content/child/thread_safe_sender.h" | 17 #include "content/child/thread_safe_sender.h" |
| 17 #include "content/common/browser_plugin/browser_plugin_messages.h" | 18 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 18 #include "content/common/content_switches_internal.h" | 19 #include "content/common/content_switches_internal.h" |
| 19 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 layer->SetBounds(device_scale_adjusted_size); | 106 layer->SetBounds(device_scale_adjusted_size); |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 void ChildFrameCompositingHelper::OnContainerDestroy() { | 110 void ChildFrameCompositingHelper::OnContainerDestroy() { |
| 110 UpdateWebLayer(nullptr); | 111 UpdateWebLayer(nullptr); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void ChildFrameCompositingHelper::ChildFrameGone() { | 114 void ChildFrameCompositingHelper::ChildFrameGone() { |
| 114 scoped_refptr<cc::SolidColorLayer> crashed_layer = | 115 scoped_refptr<cc::SolidColorLayer> crashed_layer = |
| 115 cc::SolidColorLayer::Create(cc_blink::WebLayerImpl::LayerSettings()); | 116 cc::SolidColorLayer::Create(cc::LayerSettings()); |
| 116 crashed_layer->SetMasksToBounds(true); | 117 crashed_layer->SetMasksToBounds(true); |
| 117 crashed_layer->SetBackgroundColor(SkColorSetARGBInline(255, 0, 128, 0)); | 118 crashed_layer->SetBackgroundColor(SkColorSetARGBInline(255, 0, 128, 0)); |
| 118 blink::WebLayer* layer = new cc_blink::WebLayerImpl(crashed_layer); | 119 blink::WebLayer* layer = new cc_blink::WebLayerImpl(crashed_layer); |
| 119 UpdateWebLayer(layer); | 120 UpdateWebLayer(layer); |
| 120 } | 121 } |
| 121 | 122 |
| 122 // static | 123 // static |
| 123 void ChildFrameCompositingHelper::SatisfyCallback( | 124 void ChildFrameCompositingHelper::SatisfyCallback( |
| 124 scoped_refptr<ThreadSafeSender> sender, | 125 scoped_refptr<ThreadSafeSender> sender, |
| 125 int host_routing_id, | 126 int host_routing_id, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 browser_plugin_->browser_plugin_instance_id()); | 178 browser_plugin_->browser_plugin_instance_id()); |
| 178 cc::SurfaceLayer::RequireCallback require_callback = | 179 cc::SurfaceLayer::RequireCallback require_callback = |
| 179 render_frame_proxy_ | 180 render_frame_proxy_ |
| 180 ? base::Bind(&ChildFrameCompositingHelper::RequireCallback, sender, | 181 ? base::Bind(&ChildFrameCompositingHelper::RequireCallback, sender, |
| 181 host_routing_id_) | 182 host_routing_id_) |
| 182 : base::Bind( | 183 : base::Bind( |
| 183 &ChildFrameCompositingHelper::RequireCallbackBrowserPlugin, | 184 &ChildFrameCompositingHelper::RequireCallbackBrowserPlugin, |
| 184 sender, host_routing_id_, | 185 sender, host_routing_id_, |
| 185 browser_plugin_->browser_plugin_instance_id()); | 186 browser_plugin_->browser_plugin_instance_id()); |
| 186 scoped_refptr<cc::SurfaceLayer> surface_layer = | 187 scoped_refptr<cc::SurfaceLayer> surface_layer = |
| 187 cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), | 188 cc::SurfaceLayer::Create(cc::LayerSettings(), |
| 188 satisfy_callback, require_callback); | 189 satisfy_callback, require_callback); |
| 189 // TODO(oshima): This is a stopgap fix so that the compositor does not | 190 // TODO(oshima): This is a stopgap fix so that the compositor does not |
| 190 // scaledown the content when 2x frame data is added to 1x parent frame data. | 191 // scaledown the content when 2x frame data is added to 1x parent frame data. |
| 191 // Fix this in cc/. | 192 // Fix this in cc/. |
| 192 if (IsUseZoomForDSFEnabled()) | 193 if (IsUseZoomForDSFEnabled()) |
| 193 scale_factor = 1.0f; | 194 scale_factor = 1.0f; |
| 194 | 195 |
| 195 surface_layer->SetSurfaceId(surface_id, scale_factor, frame_size); | 196 surface_layer->SetSurfaceId(surface_id, scale_factor, frame_size); |
| 196 surface_layer->SetMasksToBounds(true); | 197 surface_layer->SetMasksToBounds(true); |
| 197 blink::WebLayer* layer = new cc_blink::WebLayerImpl(surface_layer); | 198 blink::WebLayer* layer = new cc_blink::WebLayerImpl(surface_layer); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 214 frame_size, scale_factor, | 215 frame_size, scale_factor, |
| 215 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); | 216 static_cast<cc_blink::WebLayerImpl*>(web_layer_.get())->layer()); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { | 219 void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { |
| 219 if (web_layer_) | 220 if (web_layer_) |
| 220 web_layer_->setDrawsContent(visible); | 221 web_layer_->setDrawsContent(visible); |
| 221 } | 222 } |
| 222 | 223 |
| 223 } // namespace content | 224 } // namespace content |
| OLD | NEW |