Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 13068002: Send vsync notification from browser to renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made the RWHV API Android-only. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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_SetVSyncNotificationEnabled,
jam 2013/04/16 16:40:34 since these messages are only sent/received on and
Sami 2013/04/16 17:13:05 Done. I've also moved them into the Android-specif
368 OnSetVSyncNotificationEnabled)
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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 } else if (frame->delegated_frame_data) { 1626 } else if (frame->delegated_frame_data) {
1621 ack.resources.swap(frame->delegated_frame_data->resource_list); 1627 ack.resources.swap(frame->delegated_frame_data->resource_list);
1622 } else if (frame->software_frame_data) { 1628 } else if (frame->software_frame_data) {
1623 ack.last_dib_id = frame->software_frame_data->dib_id; 1629 ack.last_dib_id = frame->software_frame_data->dib_id;
1624 } 1630 }
1625 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack); 1631 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack);
1626 } 1632 }
1627 return true; 1633 return true;
1628 } 1634 }
1629 1635
1636 void RenderWidgetHostImpl::OnSetVSyncNotificationEnabled(bool enabled) {
1637 #if defined(OS_ANDROID)
1638 view_->SetVSyncNotificationEnabled(enabled);
1639 #endif
1640 }
1641
1630 void RenderWidgetHostImpl::OnUpdateRect( 1642 void RenderWidgetHostImpl::OnUpdateRect(
1631 const ViewHostMsg_UpdateRect_Params& params) { 1643 const ViewHostMsg_UpdateRect_Params& params) {
1632 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); 1644 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect");
1633 TimeTicks paint_start = TimeTicks::Now(); 1645 TimeTicks paint_start = TimeTicks::Now();
1634 1646
1635 // Update our knowledge of the RenderWidget's size. 1647 // Update our knowledge of the RenderWidget's size.
1636 current_size_ = params.view_size; 1648 current_size_ = params.view_size;
1637 // Update our knowledge of the RenderWidget's scroll offset. 1649 // Update our knowledge of the RenderWidget's scroll offset.
1638 last_scroll_offset_ = params.scroll_offset; 1650 last_scroll_offset_ = params.scroll_offset;
1639 1651
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 return; 2477 return;
2466 2478
2467 OnRenderAutoResized(new_size); 2479 OnRenderAutoResized(new_size);
2468 } 2480 }
2469 2481
2470 void RenderWidgetHostImpl::DetachDelegate() { 2482 void RenderWidgetHostImpl::DetachDelegate() {
2471 delegate_ = NULL; 2483 delegate_ = NULL;
2472 } 2484 }
2473 2485
2474 } // namespace content 2486 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698