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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, | 1602 NOTIFICATION_RENDER_WIDGET_HOST_DID_UPDATE_BACKING_STORE, |
1603 Source<RenderWidgetHost>(this), | 1603 Source<RenderWidgetHost>(this), |
1604 NotificationService::NoDetails()); | 1604 NotificationService::NoDetails()); |
1605 | 1605 |
1606 // We don't need to update the view if the view is hidden. We must do this | 1606 // We don't need to update the view if the view is hidden. We must do this |
1607 // early return after the ACK is sent, however, or the renderer will not send | 1607 // early return after the ACK is sent, however, or the renderer will not send |
1608 // us more data. | 1608 // us more data. |
1609 if (is_hidden_) | 1609 if (is_hidden_) |
1610 return; | 1610 return; |
1611 | 1611 |
1612 // Now paint the view. Watch out: it might be destroyed already. | |
1613 if (view_ && !is_accelerated_compositing_active_) { | |
1614 | |
1615 std::vector<ui::LatencyInfo> latency_info; | |
1616 for (size_t i = 0; i < params.latency_info.size(); i++) { | |
1617 ui::LatencyInfo info = params.latency_info[i]; | |
1618 AddLatencyInfoComponentIds(&info); | |
1619 latency_info.push_back(info); | |
1620 } | |
1621 | |
1622 view_being_painted_ = true; | |
1623 view_->DidUpdateBackingStore(params.scroll_rect, params.scroll_delta, | |
1624 params.copy_rects, latency_info); | |
1625 view_->DidReceiveRendererFrame(); | |
1626 view_being_painted_ = false; | |
1627 } | |
1628 | |
1629 // If we got a resize ack, then perhaps we have another resize to send? | 1612 // If we got a resize ack, then perhaps we have another resize to send? |
1630 bool is_resize_ack = | 1613 bool is_resize_ack = |
1631 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 1614 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
1632 if (is_resize_ack) | 1615 if (is_resize_ack) |
1633 WasResized(); | 1616 WasResized(); |
1634 | 1617 |
1635 // Log the time delta for processing a paint message. | 1618 // Log the time delta for processing a paint message. |
1636 TimeTicks now = TimeTicks::Now(); | 1619 TimeTicks now = TimeTicks::Now(); |
1637 TimeDelta delta = now - update_start; | 1620 TimeDelta delta = now - update_start; |
1638 UMA_HISTOGRAM_TIMES("MPArch.RWH_DidUpdateBackingStore", delta); | 1621 UMA_HISTOGRAM_TIMES("MPArch.RWH_DidUpdateBackingStore", delta); |
1639 | |
1640 // Measures the time from receiving the MsgUpdateRect IPC to completing the | |
1641 // DidUpdateBackingStore() method. On platforms which have asynchronous | |
1642 // painting, such as Linux, this is the sum of MPArch.RWH_OnMsgUpdateRect, | |
1643 // MPArch.RWH_DidUpdateBackingStore, and the time spent asynchronously | |
1644 // waiting for the paint to complete. | |
1645 // | |
1646 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect. | |
1647 delta = now - paint_start; | |
1648 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta); | |
1649 } | 1622 } |
1650 | 1623 |
1651 void RenderWidgetHostImpl::OnQueueSyntheticGesture( | 1624 void RenderWidgetHostImpl::OnQueueSyntheticGesture( |
1652 const SyntheticGesturePacket& gesture_packet) { | 1625 const SyntheticGesturePacket& gesture_packet) { |
1653 // Only allow untrustworthy gestures if explicitly enabled. | 1626 // Only allow untrustworthy gestures if explicitly enabled. |
1654 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 1627 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
1655 cc::switches::kEnableGpuBenchmarking)) { | 1628 cc::switches::kEnableGpuBenchmarking)) { |
1656 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH7")); | 1629 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH7")); |
1657 GetProcess()->ReceivedBadMessage(); | 1630 GetProcess()->ReceivedBadMessage(); |
1658 return; | 1631 return; |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 } | 2331 } |
2359 } | 2332 } |
2360 | 2333 |
2361 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2334 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
2362 if (view_) | 2335 if (view_) |
2363 return view_->PreferredReadbackFormat(); | 2336 return view_->PreferredReadbackFormat(); |
2364 return SkBitmap::kARGB_8888_Config; | 2337 return SkBitmap::kARGB_8888_Config; |
2365 } | 2338 } |
2366 | 2339 |
2367 } // namespace content | 2340 } // namespace content |
OLD | NEW |