| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 resize_ack_pending_(false), | 175 resize_ack_pending_(false), |
| 176 screen_info_out_of_date_(false), | 176 screen_info_out_of_date_(false), |
| 177 overdraw_bottom_height_(0.f), | 177 overdraw_bottom_height_(0.f), |
| 178 should_auto_resize_(false), | 178 should_auto_resize_(false), |
| 179 waiting_for_screen_rects_ack_(false), | 179 waiting_for_screen_rects_ack_(false), |
| 180 accessibility_mode_(AccessibilityModeOff), | 180 accessibility_mode_(AccessibilityModeOff), |
| 181 needs_repainting_on_restore_(false), | 181 needs_repainting_on_restore_(false), |
| 182 is_unresponsive_(false), | 182 is_unresponsive_(false), |
| 183 in_flight_event_count_(0), | 183 in_flight_event_count_(0), |
| 184 in_get_backing_store_(false), | 184 in_get_backing_store_(false), |
| 185 view_being_painted_(false), | |
| 186 ignore_input_events_(false), | 185 ignore_input_events_(false), |
| 187 input_method_active_(false), | 186 input_method_active_(false), |
| 188 text_direction_updated_(false), | 187 text_direction_updated_(false), |
| 189 text_direction_(blink::WebTextDirectionLeftToRight), | 188 text_direction_(blink::WebTextDirectionLeftToRight), |
| 190 text_direction_canceled_(false), | 189 text_direction_canceled_(false), |
| 191 suppress_next_char_events_(false), | 190 suppress_next_char_events_(false), |
| 192 pending_mouse_lock_request_(false), | 191 pending_mouse_lock_request_(false), |
| 193 allow_privileged_mouse_lock_(false), | 192 allow_privileged_mouse_lock_(false), |
| 194 has_touch_handler_(false), | 193 has_touch_handler_(false), |
| 195 weak_factory_(this), | 194 weak_factory_(this), |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 | 739 |
| 741 WaitForSurface(); | 740 WaitForSurface(); |
| 742 } | 741 } |
| 743 | 742 |
| 744 bool RenderWidgetHostImpl::CanPauseForPendingResizeOrRepaints() { | 743 bool RenderWidgetHostImpl::CanPauseForPendingResizeOrRepaints() { |
| 745 // Do not pause if the view is hidden. | 744 // Do not pause if the view is hidden. |
| 746 if (is_hidden()) | 745 if (is_hidden()) |
| 747 return false; | 746 return false; |
| 748 | 747 |
| 749 // Do not pause if there is not a paint or resize already coming. | 748 // Do not pause if there is not a paint or resize already coming. |
| 750 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) | 749 if (!repaint_ack_pending_ && !resize_ack_pending_) |
| 751 return false; | 750 return false; |
| 752 | 751 |
| 753 return true; | 752 return true; |
| 754 } | 753 } |
| 755 | 754 |
| 756 void RenderWidgetHostImpl::WaitForSurface() { | 755 void RenderWidgetHostImpl::WaitForSurface() { |
| 757 TRACE_EVENT0("browser", "RenderWidgetHostImpl::WaitForSurface"); | 756 TRACE_EVENT0("browser", "RenderWidgetHostImpl::WaitForSurface"); |
| 758 | 757 |
| 759 if (!view_) | 758 if (!view_) |
| 760 return; | 759 return; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 789 DCHECK(!in_get_backing_store_) << "WaitForSurface called recursively!"; | 788 DCHECK(!in_get_backing_store_) << "WaitForSurface called recursively!"; |
| 790 base::AutoReset<bool> auto_reset_in_get_backing_store( | 789 base::AutoReset<bool> auto_reset_in_get_backing_store( |
| 791 &in_get_backing_store_, true); | 790 &in_get_backing_store_, true); |
| 792 | 791 |
| 793 // We might have a surface that we can use! | 792 // We might have a surface that we can use! |
| 794 if (view_->HasAcceleratedSurface(view_size)) | 793 if (view_->HasAcceleratedSurface(view_size)) |
| 795 return; | 794 return; |
| 796 | 795 |
| 797 // We do not have a suitable backing store in the cache, so send out a | 796 // We do not have a suitable backing store in the cache, so send out a |
| 798 // request to the renderer to paint the view if required. | 797 // request to the renderer to paint the view if required. |
| 799 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) { | 798 if (!repaint_ack_pending_ && !resize_ack_pending_) { |
| 800 repaint_start_time_ = TimeTicks::Now(); | 799 repaint_start_time_ = TimeTicks::Now(); |
| 801 repaint_ack_pending_ = true; | 800 repaint_ack_pending_ = true; |
| 802 TRACE_EVENT_ASYNC_BEGIN0( | 801 TRACE_EVENT_ASYNC_BEGIN0( |
| 803 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); | 802 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); |
| 804 Send(new ViewMsg_Repaint(routing_id_, view_size)); | 803 Send(new ViewMsg_Repaint(routing_id_, view_size)); |
| 805 } | 804 } |
| 806 | 805 |
| 807 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); | 806 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); |
| 808 TimeTicks end_time = TimeTicks::Now() + max_delay; | 807 TimeTicks end_time = TimeTicks::Now() + max_delay; |
| 809 do { | 808 do { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 833 // Loop if we still have time left and haven't gotten a properly sized | 832 // Loop if we still have time left and haven't gotten a properly sized |
| 834 // BackingStore yet. This is necessary to support the GPU path which | 833 // BackingStore yet. This is necessary to support the GPU path which |
| 835 // typically has multiple frames pipelined -- we may need to skip one or two | 834 // typically has multiple frames pipelined -- we may need to skip one or two |
| 836 // BackingStore messages to get to the latest. | 835 // BackingStore messages to get to the latest. |
| 837 max_delay = end_time - TimeTicks::Now(); | 836 max_delay = end_time - TimeTicks::Now(); |
| 838 } while (max_delay > TimeDelta::FromSeconds(0)); | 837 } while (max_delay > TimeDelta::FromSeconds(0)); |
| 839 } | 838 } |
| 840 | 839 |
| 841 bool RenderWidgetHostImpl::ScheduleComposite() { | 840 bool RenderWidgetHostImpl::ScheduleComposite() { |
| 842 if (is_hidden_ || current_size_.IsEmpty() || repaint_ack_pending_ || | 841 if (is_hidden_ || current_size_.IsEmpty() || repaint_ack_pending_ || |
| 843 resize_ack_pending_ || view_being_painted_) { | 842 resize_ack_pending_) { |
| 844 return false; | 843 return false; |
| 845 } | 844 } |
| 846 | 845 |
| 847 // Send out a request to the renderer to paint the view if required. | 846 // Send out a request to the renderer to paint the view if required. |
| 848 repaint_start_time_ = TimeTicks::Now(); | 847 repaint_start_time_ = TimeTicks::Now(); |
| 849 repaint_ack_pending_ = true; | 848 repaint_ack_pending_ = true; |
| 850 TRACE_EVENT_ASYNC_BEGIN0( | 849 TRACE_EVENT_ASYNC_BEGIN0( |
| 851 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); | 850 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); |
| 852 Send(new ViewMsg_Repaint(routing_id_, current_size_)); | 851 Send(new ViewMsg_Repaint(routing_id_, current_size_)); |
| 853 return true; | 852 return true; |
| (...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2322 } | 2321 } |
| 2323 } | 2322 } |
| 2324 | 2323 |
| 2325 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2324 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2326 if (view_) | 2325 if (view_) |
| 2327 return view_->PreferredReadbackFormat(); | 2326 return view_->PreferredReadbackFormat(); |
| 2328 return SkBitmap::kARGB_8888_Config; | 2327 return SkBitmap::kARGB_8888_Config; |
| 2329 } | 2328 } |
| 2330 | 2329 |
| 2331 } // namespace content | 2330 } // namespace content |
| OLD | NEW |