| 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 <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 resize_ack_pending_(false), | 176 resize_ack_pending_(false), |
| 177 screen_info_out_of_date_(false), | 177 screen_info_out_of_date_(false), |
| 178 overdraw_bottom_height_(0.f), | 178 overdraw_bottom_height_(0.f), |
| 179 should_auto_resize_(false), | 179 should_auto_resize_(false), |
| 180 waiting_for_screen_rects_ack_(false), | 180 waiting_for_screen_rects_ack_(false), |
| 181 accessibility_mode_(AccessibilityModeOff), | 181 accessibility_mode_(AccessibilityModeOff), |
| 182 needs_repainting_on_restore_(false), | 182 needs_repainting_on_restore_(false), |
| 183 is_unresponsive_(false), | 183 is_unresponsive_(false), |
| 184 in_flight_event_count_(0), | 184 in_flight_event_count_(0), |
| 185 in_get_backing_store_(false), | 185 in_get_backing_store_(false), |
| 186 abort_get_backing_store_(false), | |
| 187 view_being_painted_(false), | 186 view_being_painted_(false), |
| 188 ignore_input_events_(false), | 187 ignore_input_events_(false), |
| 189 input_method_active_(false), | 188 input_method_active_(false), |
| 190 text_direction_updated_(false), | 189 text_direction_updated_(false), |
| 191 text_direction_(blink::WebTextDirectionLeftToRight), | 190 text_direction_(blink::WebTextDirectionLeftToRight), |
| 192 text_direction_canceled_(false), | 191 text_direction_canceled_(false), |
| 193 suppress_next_char_events_(false), | 192 suppress_next_char_events_(false), |
| 194 pending_mouse_lock_request_(false), | 193 pending_mouse_lock_request_(false), |
| 195 allow_privileged_mouse_lock_(false), | 194 allow_privileged_mouse_lock_(false), |
| 196 has_touch_handler_(false), | 195 has_touch_handler_(false), |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | 459 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) |
| 461 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 460 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
| 462 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, | 461 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, |
| 463 OnUpdateScreenRectsAck) | 462 OnUpdateScreenRectsAck) |
| 464 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 463 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
| 465 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) | 464 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) |
| 466 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 465 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
| 467 msg_is_ok = OnSwapCompositorFrame(msg)) | 466 msg_is_ok = OnSwapCompositorFrame(msg)) |
| 468 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) | 467 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) |
| 469 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 468 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
| 470 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) | |
| 471 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) | 469 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) |
| 472 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) | 470 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) |
| 473 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | 471 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) |
| 474 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTouchEventEmulationEnabled, | 472 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTouchEventEmulationEnabled, |
| 475 OnSetTouchEventEmulationEnabled) | 473 OnSetTouchEventEmulationEnabled) |
| 476 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, | 474 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, |
| 477 OnTextInputTypeChanged) | 475 OnTextInputTypeChanged) |
| 478 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 476 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
| 479 OnImeCancelComposition) | 477 OnImeCancelComposition) |
| 480 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, | 478 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 if (process_->WaitForBackingStoreMsg(routing_id_, max_delay, &msg)) { | 819 if (process_->WaitForBackingStoreMsg(routing_id_, max_delay, &msg)) { |
| 822 OnMessageReceived(msg); | 820 OnMessageReceived(msg); |
| 823 | 821 |
| 824 // For auto-resized views, current_size_ determines the view_size and it | 822 // For auto-resized views, current_size_ determines the view_size and it |
| 825 // may have changed during the handling of an UpdateRect message. | 823 // may have changed during the handling of an UpdateRect message. |
| 826 if (should_auto_resize_) | 824 if (should_auto_resize_) |
| 827 view_size = current_size_; | 825 view_size = current_size_; |
| 828 | 826 |
| 829 // Break now if we got a backing store or accelerated surface of the | 827 // Break now if we got a backing store or accelerated surface of the |
| 830 // correct size. | 828 // correct size. |
| 831 if (view_->HasAcceleratedSurface(view_size) || abort_get_backing_store_) { | 829 if (view_->HasAcceleratedSurface(view_size)) |
| 832 abort_get_backing_store_ = false; | |
| 833 return; | 830 return; |
| 834 } | |
| 835 } else { | 831 } else { |
| 836 TRACE_EVENT0("renderer_host", "WaitForSurface::Timeout"); | 832 TRACE_EVENT0("renderer_host", "WaitForSurface::Timeout"); |
| 837 break; | 833 break; |
| 838 } | 834 } |
| 839 | 835 |
| 840 // Loop if we still have time left and haven't gotten a properly sized | 836 // Loop if we still have time left and haven't gotten a properly sized |
| 841 // BackingStore yet. This is necessary to support the GPU path which | 837 // BackingStore yet. This is necessary to support the GPU path which |
| 842 // typically has multiple frames pipelined -- we may need to skip one or two | 838 // typically has multiple frames pipelined -- we may need to skip one or two |
| 843 // BackingStore messages to get to the latest. | 839 // BackingStore messages to get to the latest. |
| 844 max_delay = end_time - TimeTicks::Now(); | 840 max_delay = end_time - TimeTicks::Now(); |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 } | 1563 } |
| 1568 } | 1564 } |
| 1569 | 1565 |
| 1570 // Log the time delta for processing a paint message. On platforms that don't | 1566 // Log the time delta for processing a paint message. On platforms that don't |
| 1571 // support asynchronous painting, this is equivalent to | 1567 // support asynchronous painting, this is equivalent to |
| 1572 // MPArch.RWH_TotalPaintTime. | 1568 // MPArch.RWH_TotalPaintTime. |
| 1573 TimeDelta delta = TimeTicks::Now() - paint_start; | 1569 TimeDelta delta = TimeTicks::Now() - paint_start; |
| 1574 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); | 1570 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); |
| 1575 } | 1571 } |
| 1576 | 1572 |
| 1577 void RenderWidgetHostImpl::OnUpdateIsDelayed() { | |
| 1578 if (in_get_backing_store_) | |
| 1579 abort_get_backing_store_ = true; | |
| 1580 } | |
| 1581 | |
| 1582 void RenderWidgetHostImpl::DidUpdateBackingStore( | 1573 void RenderWidgetHostImpl::DidUpdateBackingStore( |
| 1583 const ViewHostMsg_UpdateRect_Params& params, | 1574 const ViewHostMsg_UpdateRect_Params& params, |
| 1584 const TimeTicks& paint_start) { | 1575 const TimeTicks& paint_start) { |
| 1585 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::DidUpdateBackingStore"); | 1576 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::DidUpdateBackingStore"); |
| 1586 TimeTicks update_start = TimeTicks::Now(); | 1577 TimeTicks update_start = TimeTicks::Now(); |
| 1587 | 1578 |
| 1588 // Move the plugins if the view hasn't already been destroyed. Plugin moves | 1579 // Move the plugins if the view hasn't already been destroyed. Plugin moves |
| 1589 // will not be re-issued, so must move them now, regardless of whether we | 1580 // will not be re-issued, so must move them now, regardless of whether we |
| 1590 // paint or not. MovePluginWindows attempts to move the plugin windows and | 1581 // paint or not. MovePluginWindows attempts to move the plugin windows and |
| 1591 // in the process could dispatch other window messages which could cause the | 1582 // in the process could dispatch other window messages which could cause the |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2345 } | 2336 } |
| 2346 } | 2337 } |
| 2347 | 2338 |
| 2348 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2339 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2349 if (view_) | 2340 if (view_) |
| 2350 return view_->PreferredReadbackFormat(); | 2341 return view_->PreferredReadbackFormat(); |
| 2351 return SkBitmap::kARGB_8888_Config; | 2342 return SkBitmap::kARGB_8888_Config; |
| 2352 } | 2343 } |
| 2353 | 2344 |
| 2354 } // namespace content | 2345 } // namespace content |
| OLD | NEW |