Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1179 weak_factory_.GetWeakPtr(), params, paint_start)); | 1179 weak_factory_.GetWeakPtr(), params, paint_start)); |
| 1180 } | 1180 } |
| 1181 } | 1181 } |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 if (!was_async) { | 1184 if (!was_async) { |
| 1185 DidUpdateBackingStore(params, paint_start); | 1185 DidUpdateBackingStore(params, paint_start); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 if (should_auto_resize_) { | 1188 if (should_auto_resize_) { |
| 1189 OnRenderAutoResized(params.view_size); | 1189 bool post_callback = new_auto_size_.IsEmpty(); |
|
sky
2012/03/20 16:15:06
Add a comment as to why you need to do this.
| |
| 1190 new_auto_size_ = params.view_size; | |
| 1191 if (post_callback) { | |
| 1192 MessageLoop::current()->PostTask( | |
| 1193 FROM_HERE, | |
| 1194 base::Bind(&RenderWidgetHostImpl::DelayedAutoResized, | |
| 1195 weak_factory_.GetWeakPtr())); | |
| 1196 } | |
| 1190 } | 1197 } |
| 1191 | 1198 |
| 1192 // Log the time delta for processing a paint message. On platforms that don't | 1199 // Log the time delta for processing a paint message. On platforms that don't |
| 1193 // support asynchronous painting, this is equivalent to | 1200 // support asynchronous painting, this is equivalent to |
| 1194 // MPArch.RWH_TotalPaintTime. | 1201 // MPArch.RWH_TotalPaintTime. |
| 1195 TimeDelta delta = TimeTicks::Now() - paint_start; | 1202 TimeDelta delta = TimeTicks::Now() - paint_start; |
| 1196 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); | 1203 UMA_HISTOGRAM_TIMES("MPArch.RWH_OnMsgUpdateRect", delta); |
| 1197 } | 1204 } |
| 1198 | 1205 |
| 1199 void RenderWidgetHostImpl::OnMsgUpdateIsDelayed() { | 1206 void RenderWidgetHostImpl::OnMsgUpdateIsDelayed() { |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1682 } | 1689 } |
| 1683 | 1690 |
| 1684 // static | 1691 // static |
| 1685 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1692 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
| 1686 int gpu_host_id) { | 1693 int gpu_host_id) { |
| 1687 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1694 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
| 1688 if (ui_shim) | 1695 if (ui_shim) |
| 1689 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1696 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
| 1690 } | 1697 } |
| 1691 | 1698 |
| 1699 void RenderWidgetHostImpl::DelayedAutoResized() { | |
| 1700 gfx::Size new_size = new_auto_size_; | |
| 1701 new_auto_size_.SetSize(0, 0); | |
| 1702 if (!should_auto_resize_) | |
| 1703 return; | |
| 1704 | |
| 1705 OnRenderAutoResized(new_size); | |
| 1706 } | |
| 1707 | |
| 1692 } // namespace content | 1708 } // namespace content |
| OLD | NEW |