| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 | 934 |
| 935 bool RenderWidgetHostImpl::IsMouseLocked() const { | 935 bool RenderWidgetHostImpl::IsMouseLocked() const { |
| 936 return view_ ? view_->IsMouseLocked() : false; | 936 return view_ ? view_->IsMouseLocked() : false; |
| 937 } | 937 } |
| 938 | 938 |
| 939 bool RenderWidgetHostImpl::IsFullscreen() const { | 939 bool RenderWidgetHostImpl::IsFullscreen() const { |
| 940 return false; | 940 return false; |
| 941 } | 941 } |
| 942 | 942 |
| 943 void RenderWidgetHostImpl::SetShouldAutoResize(bool enable) { | 943 void RenderWidgetHostImpl::SetShouldAutoResize(bool enable) { |
| 944 // Note if this switches from true to false then one has to verify that the | 944 should_auto_resize_ = enable; |
| 945 // mechanics about all the messaging works. For example, what happens to a | |
| 946 // update message rect that was in progress from the render widget. Perhaps, | |
| 947 // on a transition to false, this should do a WasResized, but what if that | |
| 948 // will not trigger a resize message...etc. Due to these complications it is | |
| 949 // fitting that this method doesn't look like a simple set method. | |
| 950 DCHECK(enable); | |
| 951 | |
| 952 // TODO: Change this to enable instead of true when this supports turning | |
| 953 // off auto-resize. | |
| 954 should_auto_resize_ = true; | |
| 955 } | 945 } |
| 956 | 946 |
| 957 void RenderWidgetHostImpl::Destroy() { | 947 void RenderWidgetHostImpl::Destroy() { |
| 958 content::NotificationService::current()->Notify( | 948 content::NotificationService::current()->Notify( |
| 959 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 949 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 960 content::Source<RenderWidgetHostImpl>(this), | 950 content::Source<RenderWidgetHostImpl>(this), |
| 961 content::NotificationService::NoDetails()); | 951 content::NotificationService::NoDetails()); |
| 962 | 952 |
| 963 // Tell the view to die. | 953 // Tell the view to die. |
| 964 // Note that in the process of the view shutting down, it can call a ton | 954 // 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... |
| 1070 // Update our knowledge of the RenderWidget's size. | 1060 // Update our knowledge of the RenderWidget's size. |
| 1071 current_size_ = params.view_size; | 1061 current_size_ = params.view_size; |
| 1072 // Update our knowledge of the RenderWidget's scroll offset. | 1062 // Update our knowledge of the RenderWidget's scroll offset. |
| 1073 last_scroll_offset_ = params.scroll_offset; | 1063 last_scroll_offset_ = params.scroll_offset; |
| 1074 | 1064 |
| 1075 bool is_resize_ack = | 1065 bool is_resize_ack = |
| 1076 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 1066 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
| 1077 | 1067 |
| 1078 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since | 1068 // resize_ack_pending_ needs to be cleared before we call DidPaintRect, since |
| 1079 // that will end up reaching GetBackingStore. | 1069 // that will end up reaching GetBackingStore. |
| 1080 if (is_resize_ack || should_auto_resize_) { | 1070 if (is_resize_ack) { |
| 1081 if (is_resize_ack) { | 1071 DCHECK(resize_ack_pending_); |
| 1082 DCHECK(resize_ack_pending_); | 1072 resize_ack_pending_ = false; |
| 1083 resize_ack_pending_ = false; | 1073 in_flight_size_.SetSize(0, 0); |
| 1084 in_flight_size_.SetSize(0, 0); | |
| 1085 } | |
| 1086 } | 1074 } |
| 1087 | 1075 |
| 1088 bool is_repaint_ack = | 1076 bool is_repaint_ack = |
| 1089 ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags); | 1077 ViewHostMsg_UpdateRect_Flags::is_repaint_ack(params.flags); |
| 1090 if (is_repaint_ack) { | 1078 if (is_repaint_ack) { |
| 1091 repaint_ack_pending_ = false; | 1079 repaint_ack_pending_ = false; |
| 1092 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; | 1080 TimeDelta delta = TimeTicks::Now() - repaint_start_time_; |
| 1093 UMA_HISTOGRAM_TIMES("MPArch.RWH_RepaintDelta", delta); | 1081 UMA_HISTOGRAM_TIMES("MPArch.RWH_RepaintDelta", delta); |
| 1094 } | 1082 } |
| 1095 | 1083 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1610 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
| 1623 } | 1611 } |
| 1624 | 1612 |
| 1625 // static | 1613 // static |
| 1626 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1614 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
| 1627 int gpu_host_id) { | 1615 int gpu_host_id) { |
| 1628 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1616 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 1629 if (ui_shim) | 1617 if (ui_shim) |
| 1630 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1618 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
| 1631 } | 1619 } |
| OLD | NEW |