Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 bool handled = true; | 188 bool handled = true; |
| 189 bool msg_is_ok = true; | 189 bool msg_is_ok = true; |
| 190 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) | 190 IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) |
| 191 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) | 191 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) |
| 192 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 192 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |
| 193 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 193 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
| 194 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 194 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
| 195 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 195 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
| 196 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) | 196 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) |
| 197 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) | 197 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) |
| 198 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) | |
| 198 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 199 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
| 199 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 200 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
| 200 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 201 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
| 201 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 202 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
| 202 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 203 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
| 203 OnMsgTextInputStateChanged) | 204 OnMsgTextInputStateChanged) |
| 204 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, | 205 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, |
| 205 OnMsgImeCompositionRangeChanged) | 206 OnMsgImeCompositionRangeChanged) |
| 206 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 207 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
| 207 OnMsgImeCancelComposition) | 208 OnMsgImeCancelComposition) |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1029 DidUpdateBackingStore(params, paint_start); | 1030 DidUpdateBackingStore(params, paint_start); |
| 1030 } | 1031 } |
| 1031 | 1032 |
| 1032 // Log the time delta for processing a paint message. On platforms that don't | 1033 // Log the time delta for processing a paint message. On platforms that don't |
| 1033 // support asynchronous painting, this is equivalent to | 1034 // support asynchronous painting, this is equivalent to |
| 1034 // MPArch.RWH_TotalPaintTime. | 1035 // MPArch.RWH_TotalPaintTime. |
| 1035 TimeDelta delta = TimeTicks::Now() - paint_start; | 1036 TimeDelta delta = TimeTicks::Now() - paint_start; |
| 1036 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); | 1037 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); |
| 1037 } | 1038 } |
| 1038 | 1039 |
| 1040 void RenderWidgetHost::OnMsgUpdateIsDelayed() { | |
| 1041 // Nothing to do, this message was just to unblock the UI thread. | |
| 1042 } | |
| 1043 | |
| 1039 void RenderWidgetHost::DidUpdateBackingStore( | 1044 void RenderWidgetHost::DidUpdateBackingStore( |
| 1040 const ViewHostMsg_UpdateRect_Params& params, | 1045 const ViewHostMsg_UpdateRect_Params& params, |
| 1041 const TimeTicks& paint_start) { | 1046 const TimeTicks& paint_start) { |
| 1042 TRACE_EVENT0("renderer_host", "RenderWidgetHost::DidUpdateBackingStore"); | 1047 TRACE_EVENT0("renderer_host", "RenderWidgetHost::DidUpdateBackingStore"); |
| 1043 TimeTicks update_start = TimeTicks::Now(); | 1048 TimeTicks update_start = TimeTicks::Now(); |
| 1044 | 1049 |
| 1045 // ACK early so we can prefetch the next PaintRect if there is a next one. | 1050 if (ViewHostMsg_UpdateRect_Flags::needs_ack(params.flags)) { |
| 1046 // This must be done AFTER we're done painting with the bitmap supplied by the | 1051 // ACK early so we can prefetch the next PaintRect if there is a next one. |
|
darin (slow to review)
2011/11/15 08:06:04
nit: indentation
piman
2011/11/16 01:00:55
Done.
| |
| 1047 // renderer. This ACK is a signal to the renderer that the backing store can | 1052 // This must be done AFTER we're done painting with the bitmap supplied by |
| 1048 // be re-used, so the bitmap may be invalid after this call. | 1053 // the renderer. This ACK is a signal to the renderer that the backing |
| 1049 Send(new ViewMsg_UpdateRect_ACK(routing_id_)); | 1054 // store can be re-used, so the bitmap may be invalid after this call. |
| 1055 Send(new ViewMsg_UpdateRect_ACK(routing_id_)); | |
| 1056 } | |
| 1050 | 1057 |
| 1051 // Move the plugins if the view hasn't already been destroyed. Plugin moves | 1058 // Move the plugins if the view hasn't already been destroyed. Plugin moves |
| 1052 // will not be re-issued, so must move them now, regardless of whether we | 1059 // will not be re-issued, so must move them now, regardless of whether we |
| 1053 // paint or not. MovePluginWindows attempts to move the plugin windows and | 1060 // paint or not. MovePluginWindows attempts to move the plugin windows and |
| 1054 // in the process could dispatch other window messages which could cause the | 1061 // in the process could dispatch other window messages which could cause the |
| 1055 // view to be destroyed. | 1062 // view to be destroyed. |
| 1056 if (view_) | 1063 if (view_) |
| 1057 view_->MovePluginWindows(params.plugin_window_moves); | 1064 view_->MovePluginWindows(params.plugin_window_moves); |
| 1058 | 1065 |
| 1059 // We don't need to update the view if the view is hidden. We must do this | 1066 // We don't need to update the view if the view is hidden. We must do this |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1462 pending_mouse_lock_request_ = false; | 1469 pending_mouse_lock_request_ = false; |
| 1463 if (!view_ || !view_->HasFocus()|| !view_->LockMouse()) { | 1470 if (!view_ || !view_->HasFocus()|| !view_->LockMouse()) { |
| 1464 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); | 1471 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); |
| 1465 return false; | 1472 return false; |
| 1466 } else { | 1473 } else { |
| 1467 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 1474 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
| 1468 return true; | 1475 return true; |
| 1469 } | 1476 } |
| 1470 } | 1477 } |
| 1471 } | 1478 } |
| OLD | NEW |