| 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/browser/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "build/build_config.h" |
| 10 #include "cc/surfaces/surface.h" | 11 #include "cc/surfaces/surface.h" |
| 11 #include "cc/surfaces/surface_factory.h" | 12 #include "cc/surfaces/surface_factory.h" |
| 12 #include "cc/surfaces/surface_manager.h" | 13 #include "cc/surfaces/surface_manager.h" |
| 13 #include "cc/surfaces/surface_sequence.h" | 14 #include "cc/surfaces/surface_sequence.h" |
| 14 #include "content/browser/accessibility/browser_accessibility_manager.h" | 15 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 15 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 16 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 16 #include "content/browser/compositor/surface_utils.h" | 17 #include "content/browser/compositor/surface_utils.h" |
| 17 #include "content/browser/frame_host/cross_process_frame_connector.h" | 18 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 18 #include "content/browser/gpu/compositor_util.h" | 19 #include "content/browser/gpu/compositor_util.h" |
| 19 #include "content/browser/renderer_host/render_view_host_impl.h" | 20 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 235 } |
| 235 | 236 |
| 236 void RenderWidgetHostViewChildFrame::LockCompositingSurface() { | 237 void RenderWidgetHostViewChildFrame::LockCompositingSurface() { |
| 237 NOTIMPLEMENTED(); | 238 NOTIMPLEMENTED(); |
| 238 } | 239 } |
| 239 | 240 |
| 240 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() { | 241 void RenderWidgetHostViewChildFrame::UnlockCompositingSurface() { |
| 241 NOTIMPLEMENTED(); | 242 NOTIMPLEMENTED(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32 output_surface_id, | 245 void RenderWidgetHostViewChildFrame::SurfaceDrawn(uint32_t output_surface_id, |
| 245 cc::SurfaceDrawStatus drawn) { | 246 cc::SurfaceDrawStatus drawn) { |
| 246 cc::CompositorFrameAck ack; | 247 cc::CompositorFrameAck ack; |
| 247 DCHECK_GT(ack_pending_count_, 0U); | 248 DCHECK_GT(ack_pending_count_, 0U); |
| 248 if (!surface_returned_resources_.empty()) | 249 if (!surface_returned_resources_.empty()) |
| 249 ack.resources.swap(surface_returned_resources_); | 250 ack.resources.swap(surface_returned_resources_); |
| 250 if (host_) { | 251 if (host_) { |
| 251 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), | 252 host_->Send(new ViewMsg_SwapCompositorFrameAck(host_->GetRoutingID(), |
| 252 output_surface_id, ack)); | 253 output_surface_id, ack)); |
| 253 } | 254 } |
| 254 ack_pending_count_--; | 255 ack_pending_count_--; |
| 255 } | 256 } |
| 256 | 257 |
| 257 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( | 258 void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( |
| 258 uint32 output_surface_id, | 259 uint32_t output_surface_id, |
| 259 scoped_ptr<cc::CompositorFrame> frame) { | 260 scoped_ptr<cc::CompositorFrame> frame) { |
| 260 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 261 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
| 261 | 262 |
| 262 if (!frame_connector_) | 263 if (!frame_connector_) |
| 263 return; | 264 return; |
| 264 | 265 |
| 265 // When not using surfaces, the frame just gets proxied to | 266 // When not using surfaces, the frame just gets proxied to |
| 266 // the embedder's renderer to be composited. | 267 // the embedder's renderer to be composited. |
| 267 if (!frame->delegated_frame_data || !use_surfaces_) { | 268 if (!frame->delegated_frame_data || !use_surfaces_) { |
| 268 frame_connector_->ChildFrameCompositorFrameSwapped( | 269 frame_connector_->ChildFrameCompositorFrameSwapped( |
| 269 output_surface_id, | 270 output_surface_id, |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 #endif | 499 #endif |
| 499 } | 500 } |
| 500 | 501 |
| 501 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 502 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
| 502 if (surface_factory_ && !surface_id_.is_null()) | 503 if (surface_factory_ && !surface_id_.is_null()) |
| 503 surface_factory_->Destroy(surface_id_); | 504 surface_factory_->Destroy(surface_id_); |
| 504 surface_id_ = cc::SurfaceId(); | 505 surface_id_ = cc::SurfaceId(); |
| 505 } | 506 } |
| 506 | 507 |
| 507 } // namespace content | 508 } // namespace content |
| OLD | NEW |