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 <utility> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 #include "cc/surfaces/surface.h" | 12 #include "cc/surfaces/surface.h" |
12 #include "cc/surfaces/surface_factory.h" | 13 #include "cc/surfaces/surface_factory.h" |
13 #include "cc/surfaces/surface_manager.h" | 14 #include "cc/surfaces/surface_manager.h" |
14 #include "cc/surfaces/surface_sequence.h" | 15 #include "cc/surfaces/surface_sequence.h" |
15 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager.h" |
16 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 17 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
17 #include "content/browser/compositor/surface_utils.h" | 18 #include "content/browser/compositor/surface_utils.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 scoped_ptr<cc::CompositorFrame> frame) { | 261 scoped_ptr<cc::CompositorFrame> frame) { |
261 last_scroll_offset_ = frame->metadata.root_scroll_offset; | 262 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
262 | 263 |
263 if (!frame_connector_) | 264 if (!frame_connector_) |
264 return; | 265 return; |
265 | 266 |
266 // When not using surfaces, the frame just gets proxied to | 267 // When not using surfaces, the frame just gets proxied to |
267 // the embedder's renderer to be composited. | 268 // the embedder's renderer to be composited. |
268 if (!frame->delegated_frame_data || !use_surfaces_) { | 269 if (!frame->delegated_frame_data || !use_surfaces_) { |
269 frame_connector_->ChildFrameCompositorFrameSwapped( | 270 frame_connector_->ChildFrameCompositorFrameSwapped( |
270 output_surface_id, | 271 output_surface_id, host_->GetProcess()->GetID(), host_->GetRoutingID(), |
271 host_->GetProcess()->GetID(), | 272 std::move(frame)); |
272 host_->GetRoutingID(), | |
273 frame.Pass()); | |
274 return; | 273 return; |
275 } | 274 } |
276 | 275 |
277 cc::RenderPass* root_pass = | 276 cc::RenderPass* root_pass = |
278 frame->delegated_frame_data->render_pass_list.back().get(); | 277 frame->delegated_frame_data->render_pass_list.back().get(); |
279 | 278 |
280 gfx::Size frame_size = root_pass->output_rect.size(); | 279 gfx::Size frame_size = root_pass->output_rect.size(); |
281 float scale_factor = frame->metadata.device_scale_factor; | 280 float scale_factor = frame->metadata.device_scale_factor; |
282 | 281 |
283 // Check whether we need to recreate the cc::Surface, which means the child | 282 // Check whether we need to recreate the cc::Surface, which means the child |
(...skipping 29 matching lines...) Expand all Loading... |
313 frame_connector_->SetChildFrameSurface(surface_id_, frame_size, | 312 frame_connector_->SetChildFrameSurface(surface_id_, frame_size, |
314 scale_factor, sequence); | 313 scale_factor, sequence); |
315 } | 314 } |
316 | 315 |
317 cc::SurfaceFactory::DrawCallback ack_callback = | 316 cc::SurfaceFactory::DrawCallback ack_callback = |
318 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(), | 317 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(), |
319 output_surface_id); | 318 output_surface_id); |
320 ack_pending_count_++; | 319 ack_pending_count_++; |
321 // If this value grows very large, something is going wrong. | 320 // If this value grows very large, something is going wrong. |
322 DCHECK_LT(ack_pending_count_, 1000U); | 321 DCHECK_LT(ack_pending_count_, 1000U); |
323 surface_factory_->SubmitCompositorFrame(surface_id_, frame.Pass(), | 322 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), |
324 ack_callback); | 323 ack_callback); |
325 } | 324 } |
326 | 325 |
327 void RenderWidgetHostViewChildFrame::GetScreenInfo( | 326 void RenderWidgetHostViewChildFrame::GetScreenInfo( |
328 blink::WebScreenInfo* results) { | 327 blink::WebScreenInfo* results) { |
329 if (!frame_connector_) | 328 if (!frame_connector_) |
330 return; | 329 return; |
331 frame_connector_->GetScreenInfo(results); | 330 frame_connector_->GetScreenInfo(results); |
332 } | 331 } |
333 | 332 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 #endif | 498 #endif |
500 } | 499 } |
501 | 500 |
502 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 501 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
503 if (surface_factory_ && !surface_id_.is_null()) | 502 if (surface_factory_ && !surface_id_.is_null()) |
504 surface_factory_->Destroy(surface_id_); | 503 surface_factory_->Destroy(surface_id_); |
505 surface_id_ = cc::SurfaceId(); | 504 surface_id_ = cc::SurfaceId(); |
506 } | 505 } |
507 | 506 |
508 } // namespace content | 507 } // namespace content |
OLD | NEW |