OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 357 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
358 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, | 358 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, |
359 OnUpdateScreenRectsAck) | 359 OnUpdateScreenRectsAck) |
360 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 360 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
361 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) | 361 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) |
362 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck) | 362 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnPaintAtSizeAck) |
363 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, | 363 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, |
364 OnCompositorSurfaceBuffersSwapped) | 364 OnCompositorSurfaceBuffersSwapped) |
365 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 365 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
366 msg_is_ok = OnSwapCompositorFrame(msg)) | 366 msg_is_ok = OnSwapCompositorFrame(msg)) |
| 367 IPC_MESSAGE_HANDLER(ViewHostMsg_EnableVSyncNotification, |
| 368 OnEnableVSyncNotification) |
367 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 369 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
368 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) | 370 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) |
369 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnInputEventAck) | 371 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnInputEventAck) |
370 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnBeginSmoothScroll) | 372 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnBeginSmoothScroll) |
371 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) | 373 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnSelectRangeAck) |
372 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) | 374 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveCaret_ACK, OnMsgMoveCaretAck) |
373 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) | 375 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) |
374 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) | 376 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) |
375 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 377 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
376 OnHasTouchEventHandlers) | 378 OnHasTouchEventHandlers) |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 } | 1289 } |
1288 | 1290 |
1289 callback.Run(success, bitmap); | 1291 callback.Run(success, bitmap); |
1290 } | 1292 } |
1291 | 1293 |
1292 void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase, | 1294 void RenderWidgetHostImpl::UpdateVSyncParameters(base::TimeTicks timebase, |
1293 base::TimeDelta interval) { | 1295 base::TimeDelta interval) { |
1294 Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval)); | 1296 Send(new ViewMsg_UpdateVSyncParameters(GetRoutingID(), timebase, interval)); |
1295 } | 1297 } |
1296 | 1298 |
| 1299 void RenderWidgetHostImpl::SendVSync(base::TimeTicks frame_time) { |
| 1300 Send(new ViewMsg_DidVSync(GetRoutingID(), frame_time)); |
| 1301 } |
| 1302 |
1297 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, | 1303 void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
1298 int exit_code) { | 1304 int exit_code) { |
1299 // Clearing this flag causes us to re-create the renderer when recovering | 1305 // Clearing this flag causes us to re-create the renderer when recovering |
1300 // from a crashed renderer. | 1306 // from a crashed renderer. |
1301 renderer_initialized_ = false; | 1307 renderer_initialized_ = false; |
1302 | 1308 |
1303 waiting_for_screen_rects_ack_ = false; | 1309 waiting_for_screen_rects_ack_ = false; |
1304 | 1310 |
1305 // Must reset these to ensure that mouse move/wheel events work with a new | 1311 // Must reset these to ensure that mouse move/wheel events work with a new |
1306 // renderer. | 1312 // renderer. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 ack.gl_frame_data = frame->gl_frame_data.Pass(); | 1623 ack.gl_frame_data = frame->gl_frame_data.Pass(); |
1618 ack.gl_frame_data->sync_point = 0; | 1624 ack.gl_frame_data->sync_point = 0; |
1619 } else if (frame->delegated_frame_data) { | 1625 } else if (frame->delegated_frame_data) { |
1620 ack.resources.swap(frame->delegated_frame_data->resource_list); | 1626 ack.resources.swap(frame->delegated_frame_data->resource_list); |
1621 } | 1627 } |
1622 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack); | 1628 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack); |
1623 } | 1629 } |
1624 return true; | 1630 return true; |
1625 } | 1631 } |
1626 | 1632 |
| 1633 void RenderWidgetHostImpl::OnEnableVSyncNotification(bool enable) { |
| 1634 TRACE_EVENT1("renderer_host", |
| 1635 "RenderWidgetHostImpl::OnEnableVSyncNotification", "enable", enable); |
| 1636 view_->EnableVSyncNotification(enable); |
| 1637 } |
| 1638 |
1627 void RenderWidgetHostImpl::OnUpdateRect( | 1639 void RenderWidgetHostImpl::OnUpdateRect( |
1628 const ViewHostMsg_UpdateRect_Params& params) { | 1640 const ViewHostMsg_UpdateRect_Params& params) { |
1629 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); | 1641 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); |
1630 TimeTicks paint_start = TimeTicks::Now(); | 1642 TimeTicks paint_start = TimeTicks::Now(); |
1631 | 1643 |
1632 // Update our knowledge of the RenderWidget's size. | 1644 // Update our knowledge of the RenderWidget's size. |
1633 current_size_ = params.view_size; | 1645 current_size_ = params.view_size; |
1634 // Update our knowledge of the RenderWidget's scroll offset. | 1646 // Update our knowledge of the RenderWidget's scroll offset. |
1635 last_scroll_offset_ = params.scroll_offset; | 1647 last_scroll_offset_ = params.scroll_offset; |
1636 | 1648 |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2464 return; | 2476 return; |
2465 | 2477 |
2466 OnRenderAutoResized(new_size); | 2478 OnRenderAutoResized(new_size); |
2467 } | 2479 } |
2468 | 2480 |
2469 void RenderWidgetHostImpl::DetachDelegate() { | 2481 void RenderWidgetHostImpl::DetachDelegate() { |
2470 delegate_ = NULL; | 2482 delegate_ = NULL; |
2471 } | 2483 } |
2472 | 2484 |
2473 } // namespace content | 2485 } // namespace content |
OLD | NEW |