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.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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 | 883 |
884 bool RenderWidgetHostImpl::IsMouseLocked() const { | 884 bool RenderWidgetHostImpl::IsMouseLocked() const { |
885 return view_ ? view_->IsMouseLocked() : false; | 885 return view_ ? view_->IsMouseLocked() : false; |
886 } | 886 } |
887 | 887 |
888 bool RenderWidgetHostImpl::IsFullscreen() const { | 888 bool RenderWidgetHostImpl::IsFullscreen() const { |
889 return false; | 889 return false; |
890 } | 890 } |
891 | 891 |
892 void RenderWidgetHostImpl::SetShouldAutoResize(bool enable) { | 892 void RenderWidgetHostImpl::SetShouldAutoResize(bool enable) { |
893 // Note if this switches from true to false then one has to verify that the | 893 should_auto_resize_ = enable; |
894 // mechanics about all the messaging works. For example, what happens to a | |
895 // update message rect that was in progress from the render widget. Perhaps, | |
896 // on a transition to false, this should do a WasResized, but what if that | |
897 // will not trigger a resize message...etc. Due to these complications it is | |
898 // fitting that this method doesn't look like a simple set method. | |
899 DCHECK(enable); | |
900 | |
901 // TODO: Change this to enable instead of true when this supports turning | |
902 // off auto-resize. | |
903 should_auto_resize_ = true; | |
904 } | 894 } |
905 | 895 |
906 void RenderWidgetHostImpl::Destroy() { | 896 void RenderWidgetHostImpl::Destroy() { |
907 content::NotificationService::current()->Notify( | 897 content::NotificationService::current()->Notify( |
908 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 898 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
909 content::Source<RenderWidgetHostImpl>(this), | 899 content::Source<RenderWidgetHostImpl>(this), |
910 content::NotificationService::NoDetails()); | 900 content::NotificationService::NoDetails()); |
911 | 901 |
912 // Tell the view to die. | 902 // Tell the view to die. |
913 // Note that in the process of the view shutting down, it can call a ton | 903 // Note that in the process of the view shutting down, it can call a ton |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 // Update our knowledge of the RenderWidget's size. | 1009 // Update our knowledge of the RenderWidget's size. |
1020 current_size_ = params.view_size; | 1010 current_size_ = params.view_size; |
1021 // Update our knowledge of the RenderWidget's scroll offset. | 1011 // Update our knowledge of the RenderWidget's scroll offset. |
1022 last_scroll_offset_ = params.scroll_offset; | 1012 last_scroll_offset_ = params.scroll_offset; |
1023 | 1013 |
1024 bool is_resize_ack = | 1014 bool is_resize_ack = |
1025 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 1015 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
1026 | 1016 |
1027 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since | 1017 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since |
1028 // that will end up reaching GetBackingStore. | 1018 // that will end up reaching GetBackingStore. |
1029 if (is_resize_ack || should_auto_resize_) { | 1019 if (is_resize_ack) { |
1030 if (is_resize_ack) { | 1020 DCHECK(resize_ack_pending_); |
1031 DCHECK(resize_ack_pending_); | 1021 resize_ack_pending_ = false; |
1032 resize_ack_pending_ = false; | 1022 in_flight_size_.SetSize(0, 0); |
1033 in_flight_size_.SetSize(0, 0); | |
1034 } | |
1035 } | 1023 } |
1036 | 1024 |
1037 bool is_repaint_ack = | 1025 bool is_repaint_ack = |
1038 ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags); | 1026 ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags); |
1039 if (is_repaint_ack) { | 1027 if (is_repaint_ack) { |
1040 repaint_ack_pending_ = false; | 1028 repaint_ack_pending_ = false; |
1041 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; | 1029 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; |
1042 UMA_HISTOGRAM_TIMES("MPArch.RWH_RepaintDelta", delta); | 1030 UMA_HISTOGRAM_TIMES("MPArch.RWH_RepaintDelta", delta); |
1043 } | 1031 } |
1044 | 1032 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1567 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
1580 } | 1568 } |
1581 | 1569 |
1582 // static | 1570 // static |
1583 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1571 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
1584 int gpu_host_id) { | 1572 int gpu_host_id) { |
1585 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1573 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1586 if (ui_shim) | 1574 if (ui_shim) |
1587 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1575 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1588 } | 1576 } |
OLD | NEW |