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

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

Issue 8498036: Delay UpdateRect until the SwapBuffers callback when accelerated compositing is on. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win compile Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/browser/renderer_host/render_widget_host.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 bool handled = true; 190 bool handled = true;
191 bool msg_is_ok = true; 191 bool msg_is_ok = true;
192 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) 192 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok)
193 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) 193 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady)
194 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) 194 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone)
195 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) 195 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
196 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) 196 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
197 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) 197 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
198 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) 198 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
199 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) 199 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
200 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed)
200 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) 201 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
201 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) 202 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
202 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) 203 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
203 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) 204 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
204 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 205 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
205 OnMsgTextInputStateChanged) 206 OnMsgTextInputStateChanged)
206 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, 207 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
207 OnMsgImeCompositionRangeChanged) 208 OnMsgImeCompositionRangeChanged)
208 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, 209 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
209 OnMsgImeCancelComposition) 210 OnMsgImeCancelComposition)
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 DidUpdateBackingStore(params, paint_start); 1057 DidUpdateBackingStore(params, paint_start);
1057 } 1058 }
1058 1059
1059 // Log the time delta for processing a paint message. On platforms that don't 1060 // Log the time delta for processing a paint message. On platforms that don't
1060 // support asynchronous painting, this is equivalent to 1061 // support asynchronous painting, this is equivalent to
1061 // MPArch.RWH_TotalPaintTime. 1062 // MPArch.RWH_TotalPaintTime.
1062 TimeDelta delta = TimeTicks::Now() - paint_start; 1063 TimeDelta delta = TimeTicks::Now() - paint_start;
1063 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); 1064 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta);
1064 } 1065 }
1065 1066
1067 void RenderWidgetHost::OnMsgUpdateIsDelayed() {
1068 // Nothing to do, this message was just to unblock the UI thread.
1069 }
1070
1066 void RenderWidgetHost::DidUpdateBackingStore( 1071 void RenderWidgetHost::DidUpdateBackingStore(
1067 const ViewHostMsg_UpdateRect_Params& params, 1072 const ViewHostMsg_UpdateRect_Params& params,
1068 const TimeTicks& paint_start) { 1073 const TimeTicks& paint_start) {
1069 TRACE_EVENT0("renderer_host", "RenderWidgetHost::DidUpdateBackingStore"); 1074 TRACE_EVENT0("renderer_host", "RenderWidgetHost::DidUpdateBackingStore");
1070 TimeTicks update_start = TimeTicks::Now(); 1075 TimeTicks update_start = TimeTicks::Now();
1071 1076
1072 // ACK early so we can prefetch the next PaintRect if there is a next one. 1077 if (params.needs_ack) {
1073 // This must be done AFTER we're done painting with the bitmap supplied by the 1078 // ACK early so we can prefetch the next PaintRect if there is a next one.
1074 // renderer. This ACK is a signal to the renderer that the backing store can 1079 // This must be done AFTER we're done painting with the bitmap supplied by
1075 // be re-used, so the bitmap may be invalid after this call. 1080 // the renderer. This ACK is a signal to the renderer that the backing store
1076 Send(new ViewMsg_UpdateRect_ACK(routing_id_)); 1081 // can be re-used, so the bitmap may be invalid after this call.
1082 Send(new ViewMsg_UpdateRect_ACK(routing_id_));
1083 }
1077 1084
1078 // Move the plugins if the view hasn't already been destroyed. Plugin moves 1085 // Move the plugins if the view hasn't already been destroyed. Plugin moves
1079 // will not be re-issued, so must move them now, regardless of whether we 1086 // will not be re-issued, so must move them now, regardless of whether we
1080 // paint or not. MovePluginWindows attempts to move the plugin windows and 1087 // paint or not. MovePluginWindows attempts to move the plugin windows and
1081 // in the process could dispatch other window messages which could cause the 1088 // in the process could dispatch other window messages which could cause the
1082 // view to be destroyed. 1089 // view to be destroyed.
1083 if (view_) 1090 if (view_)
1084 view_->MovePluginWindows(params.plugin_window_moves); 1091 view_->MovePluginWindows(params.plugin_window_moves);
1085 1092
1086 // We don't need to update the view if the view is hidden. We must do this 1093 // We don't need to update the view if the view is hidden. We must do this
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 if (!view_ || !view_->HasFocus()|| !view_->LockMouse()) { 1508 if (!view_ || !view_->HasFocus()|| !view_->LockMouse()) {
1502 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); 1509 Send(new ViewMsg_LockMouse_ACK(routing_id_, false));
1503 return false; 1510 return false;
1504 } else { 1511 } else {
1505 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); 1512 Send(new ViewMsg_LockMouse_ACK(routing_id_, true));
1506 return true; 1513 return true;
1507 } 1514 }
1508 } 1515 }
1509 } 1516 }
1510 1517
1511 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
1512 // static 1518 // static
1513 void RenderWidgetHost::AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) { 1519 void RenderWidgetHost::AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) {
1514 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); 1520 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id);
1515 if (ui_shim) 1521 if (ui_shim)
1516 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); 1522 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
1517 } 1523 }
1518 1524
1519 // static 1525 // static
1520 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, 1526 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id,
1521 int gpu_host_id) { 1527 int gpu_host_id) {
1522 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); 1528 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id);
1523 if (ui_shim) 1529 if (ui_shim)
1524 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); 1530 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id));
1525 } 1531 }
1526 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698