| 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 "cc/layers/delegated_frame_provider.h" | 7 #include "cc/layers/delegated_frame_provider.h" |
| 8 #include "cc/layers/delegated_frame_resource_collection.h" | 8 #include "cc/layers/delegated_frame_resource_collection.h" |
| 9 #include "cc/layers/delegated_renderer_layer.h" | 9 #include "cc/layers/delegated_renderer_layer.h" |
| 10 #include "cc/layers/solid_color_layer.h" | 10 #include "cc/layers/solid_color_layer.h" |
| 11 #include "cc/layers/texture_layer.h" | 11 #include "cc/layers/texture_layer.h" |
| 12 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
| 13 #include "cc/output/copy_output_request.h" | 13 #include "cc/output/copy_output_request.h" |
| 14 #include "cc/output/copy_output_result.h" | 14 #include "cc/output/copy_output_result.h" |
| 15 #include "cc/resources/single_release_callback.h" | 15 #include "cc/resources/single_release_callback.h" |
| 16 #include "content/common/browser_plugin/browser_plugin_messages.h" | 16 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 17 #include "content/common/frame_messages.h" | 17 #include "content/common/frame_messages.h" |
| 18 #include "content/common/gpu/client/context_provider_command_buffer.h" | 18 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 19 #include "content/renderer/browser_plugin/browser_plugin.h" | 19 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 20 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 20 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 21 #include "content/renderer/compositor_bindings/web_layer_impl.h" |
| 21 #include "content/renderer/render_frame_impl.h" | 22 #include "content/renderer/render_frame_impl.h" |
| 22 #include "content/renderer/render_thread_impl.h" | 23 #include "content/renderer/render_thread_impl.h" |
| 23 #include "skia/ext/image_operations.h" | 24 #include "skia/ext/image_operations.h" |
| 24 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 25 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 25 #include "third_party/WebKit/public/web/WebFrame.h" | 26 #include "third_party/WebKit/public/web/WebFrame.h" |
| 26 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 27 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 27 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
| 28 #include "ui/gfx/size_conversions.h" | 29 #include "ui/gfx/size_conversions.h" |
| 29 #include "ui/gfx/skia_util.h" | 30 #include "ui/gfx/skia_util.h" |
| 30 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 | 33 |
| 34 ChildFrameCompositingHelper::SwapBuffersInfo::SwapBuffersInfo() | 34 ChildFrameCompositingHelper::SwapBuffersInfo::SwapBuffersInfo() |
| 35 : route_id(0), | 35 : route_id(0), |
| 36 output_surface_id(0), | 36 output_surface_id(0), |
| 37 host_id(0), | 37 host_id(0), |
| 38 software_frame_id(0), | 38 software_frame_id(0), |
| 39 shared_memory(NULL) {} | 39 shared_memory(NULL) {} |
| 40 | 40 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 ack_pending_ = false; | 180 ack_pending_ = false; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ChildFrameCompositingHelper::EnableCompositing(bool enable) { | 183 void ChildFrameCompositingHelper::EnableCompositing(bool enable) { |
| 184 if (enable && !background_layer_.get()) { | 184 if (enable && !background_layer_.get()) { |
| 185 background_layer_ = cc::SolidColorLayer::Create(); | 185 background_layer_ = cc::SolidColorLayer::Create(); |
| 186 background_layer_->SetMasksToBounds(true); | 186 background_layer_->SetMasksToBounds(true); |
| 187 background_layer_->SetBackgroundColor( | 187 background_layer_->SetBackgroundColor( |
| 188 SkColorSetARGBInline(255, 255, 255, 255)); | 188 SkColorSetARGBInline(255, 255, 255, 255)); |
| 189 web_layer_.reset(new webkit::WebLayerImpl(background_layer_)); | 189 web_layer_.reset(new WebLayerImpl(background_layer_)); |
| 190 } | 190 } |
| 191 | 191 |
| 192 if (GetContainer()) { | 192 if (GetContainer()) { |
| 193 GetContainer()->setWebLayer(enable ? web_layer_.get() : NULL); | 193 GetContainer()->setWebLayer(enable ? web_layer_.get() : NULL); |
| 194 } else if (frame_) { | 194 } else if (frame_) { |
| 195 frame_->setRemoteWebLayer(enable ? web_layer_.get() : NULL); | 195 frame_->setRemoteWebLayer(enable ? web_layer_.get() : NULL); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 void ChildFrameCompositingHelper::CheckSizeAndAdjustLayerProperties( | 199 void ChildFrameCompositingHelper::CheckSizeAndAdjustLayerProperties( |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 dest_size.height()); | 557 dest_size.height()); |
| 558 } | 558 } |
| 559 if (GetBrowserPluginManager()) { | 559 if (GetBrowserPluginManager()) { |
| 560 GetBrowserPluginManager()->Send( | 560 GetBrowserPluginManager()->Send( |
| 561 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck( | 561 new BrowserPluginHostMsg_CopyFromCompositingSurfaceAck( |
| 562 host_routing_id_, GetInstanceID(), request_id, resized_bitmap)); | 562 host_routing_id_, GetInstanceID(), request_id, resized_bitmap)); |
| 563 } | 563 } |
| 564 } | 564 } |
| 565 | 565 |
| 566 } // namespace content | 566 } // namespace content |
| OLD | NEW |