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_guest.h" | 5 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 current_surface_size_ = frame_size; | 305 current_surface_size_ = frame_size; |
306 current_surface_scale_factor_ = scale_factor; | 306 current_surface_scale_factor_ = scale_factor; |
307 } | 307 } |
308 | 308 |
309 bool allocated_new_local_frame_id = false; | 309 bool allocated_new_local_frame_id = false; |
310 if (!local_frame_id_.is_valid()) { | 310 if (!local_frame_id_.is_valid()) { |
311 local_frame_id_ = id_allocator_->GenerateId(); | 311 local_frame_id_ = id_allocator_->GenerateId(); |
312 allocated_new_local_frame_id = true; | 312 allocated_new_local_frame_id = true; |
313 } | 313 } |
314 | 314 |
| 315 uint64_t begin_frame_source_id = frame.metadata.begin_frame_source_id; |
| 316 uint64_t begin_frame_number = frame.metadata.begin_frame_number; |
| 317 uint64_t latest_confirmed_frame = frame.metadata.latest_confirmed_frame; |
| 318 |
315 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( | 319 cc::SurfaceFactory::DrawCallback ack_callback = base::Bind( |
316 &RenderWidgetHostViewChildFrame::SurfaceDrawn, | 320 &RenderWidgetHostViewChildFrame::SurfaceDrawn, |
317 RenderWidgetHostViewChildFrame::AsWeakPtr(), compositor_frame_sink_id); | 321 RenderWidgetHostViewChildFrame::AsWeakPtr(), compositor_frame_sink_id); |
318 ack_pending_count_++; | 322 ack_pending_count_++; |
319 // If this value grows very large, something is going wrong. | 323 // If this value grows very large, something is going wrong. |
320 DCHECK(ack_pending_count_ < 1000); | 324 DCHECK(ack_pending_count_ < 1000); |
321 surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), | 325 surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), |
322 ack_callback); | 326 ack_callback); |
323 | 327 |
324 if (allocated_new_local_frame_id) { | 328 if (allocated_new_local_frame_id) { |
(...skipping 13 matching lines...) Expand all Loading... |
338 sequence); | 342 sequence); |
339 } | 343 } |
340 } | 344 } |
341 ProcessFrameSwappedCallbacks(); | 345 ProcessFrameSwappedCallbacks(); |
342 | 346 |
343 // If after detaching we are sent a frame, we should finish processing it, and | 347 // If after detaching we are sent a frame, we should finish processing it, and |
344 // then we should clear the surface so that we are not holding resources we | 348 // then we should clear the surface so that we are not holding resources we |
345 // no longer need. | 349 // no longer need. |
346 if (!guest_ || !guest_->attached()) | 350 if (!guest_ || !guest_->attached()) |
347 ClearCompositorSurfaceIfNecessary(); | 351 ClearCompositorSurfaceIfNecessary(); |
| 352 |
| 353 DidSwapFrame(begin_frame_source_id, begin_frame_number, |
| 354 latest_confirmed_frame); |
348 } | 355 } |
349 | 356 |
350 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { | 357 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { |
351 if (!platform_view_) { | 358 if (!platform_view_) { |
352 // In theory, we can get here if there's a delay between Destroy() | 359 // In theory, we can get here if there's a delay between Destroy() |
353 // being called and when our destructor is invoked. | 360 // being called and when our destructor is invoked. |
354 return false; | 361 return false; |
355 } | 362 } |
356 | 363 |
357 return platform_view_->OnMessageReceived(msg); | 364 return platform_view_->OnMessageReceived(msg); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 gesture_event.data.scrollUpdate.inertialPhase == | 696 gesture_event.data.scrollUpdate.inertialPhase == |
690 blink::WebGestureEvent::MomentumPhase) { | 697 blink::WebGestureEvent::MomentumPhase) { |
691 return; | 698 return; |
692 } | 699 } |
693 host_->ForwardGestureEvent(gesture_event); | 700 host_->ForwardGestureEvent(gesture_event); |
694 return; | 701 return; |
695 } | 702 } |
696 } | 703 } |
697 | 704 |
698 } // namespace content | 705 } // namespace content |
OLD | NEW |