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

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: Rename EnableVSyncNotification to SetVSyncNotificationEnabled Created 7 years, 9 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,
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 ack.gl_frame_data = frame->gl_frame_data.Pass(); 1624 ack.gl_frame_data = frame->gl_frame_data.Pass();
1619 ack.gl_frame_data->sync_point = 0; 1625 ack.gl_frame_data->sync_point = 0;
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 } 1628 }
1623 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack); 1629 SendSwapCompositorFrameAck(routing_id_, process_->GetID(), ack);
1624 } 1630 }
1625 return true; 1631 return true;
1626 } 1632 }
1627 1633
1634 void RenderWidgetHostImpl::OnSetVSyncNotificationEnabled(bool enabled) {
1635 TRACE_EVENT1("renderer_host",
1636 "RenderWidgetHostImpl::OnSetVSyncNotificationEnabled",
1637 "enabled", enabled);
jam 2013/03/27 16:13:06 does this need to be traced? i.e. is this somethin
Sami 2013/03/27 17:38:06 This particular trace was for human eyes only (i.e
1638 view_->SetVSyncNotificationEnabled(enabled);
1639 }
1640
1628 void RenderWidgetHostImpl::OnUpdateRect( 1641 void RenderWidgetHostImpl::OnUpdateRect(
1629 const ViewHostMsg_UpdateRect_Params& params) { 1642 const ViewHostMsg_UpdateRect_Params& params) {
1630 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect"); 1643 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnUpdateRect");
1631 TimeTicks paint_start = TimeTicks::Now(); 1644 TimeTicks paint_start = TimeTicks::Now();
1632 1645
1633 // Update our knowledge of the RenderWidget's size. 1646 // Update our knowledge of the RenderWidget's size.
1634 current_size_ = params.view_size; 1647 current_size_ = params.view_size;
1635 // Update our knowledge of the RenderWidget's scroll offset. 1648 // Update our knowledge of the RenderWidget's scroll offset.
1636 last_scroll_offset_ = params.scroll_offset; 1649 last_scroll_offset_ = params.scroll_offset;
1637 1650
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 return; 2482 return;
2470 2483
2471 OnRenderAutoResized(new_size); 2484 OnRenderAutoResized(new_size);
2472 } 2485 }
2473 2486
2474 void RenderWidgetHostImpl::DetachDelegate() { 2487 void RenderWidgetHostImpl::DetachDelegate() {
2475 delegate_ = NULL; 2488 delegate_ = NULL;
2476 } 2489 }
2477 2490
2478 } // namespace content 2491 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698