Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 841443002: mac: Add a metric for the time blocked by WaitForSurface(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from ccameron. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 // request to the renderer to paint the view if required. 798 // request to the renderer to paint the view if required.
799 if (!repaint_ack_pending_ && !resize_ack_pending_) { 799 if (!repaint_ack_pending_ && !resize_ack_pending_) {
800 repaint_start_time_ = TimeTicks::Now(); 800 repaint_start_time_ = TimeTicks::Now();
801 repaint_ack_pending_ = true; 801 repaint_ack_pending_ = true;
802 TRACE_EVENT_ASYNC_BEGIN0( 802 TRACE_EVENT_ASYNC_BEGIN0(
803 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); 803 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this);
804 Send(new ViewMsg_Repaint(routing_id_, view_size)); 804 Send(new ViewMsg_Repaint(routing_id_, view_size));
805 } 805 }
806 806
807 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS); 807 TimeDelta max_delay = TimeDelta::FromMilliseconds(kPaintMsgTimeoutMS);
808 TimeTicks end_time = TimeTicks::Now() + max_delay; 808 TimeTicks start_time = TimeTicks::Now();
809 TimeDelta elapsed_delay;
809 do { 810 do {
810 TRACE_EVENT0("renderer_host", "WaitForSurface::WaitForUpdate"); 811 TRACE_EVENT0("renderer_host", "WaitForSurface::WaitForUpdate");
811 812
812 // When we have asked the RenderWidget to resize, and we are still waiting 813 // When we have asked the RenderWidget to resize, and we are still waiting
813 // on a response, block for a little while to see if we can't get a response 814 // on a response, block for a little while to see if we can't get a response
814 // before returning the old (incorrectly sized) backing store. 815 // before returning the old (incorrectly sized) backing store.
815 IPC::Message msg; 816 IPC::Message msg;
816 if (RenderWidgetResizeHelper::Get()->WaitForSingleTaskToRun(max_delay)) { 817 if (RenderWidgetResizeHelper::Get()->WaitForSingleTaskToRun(max_delay)) {
817 818
818 // For auto-resized views, current_size_ determines the view_size and it 819 // For auto-resized views, current_size_ determines the view_size and it
819 // may have changed during the handling of an UpdateRect message. 820 // may have changed during the handling of an UpdateRect message.
820 if (auto_resize_enabled_) 821 if (auto_resize_enabled_)
821 view_size = current_size_; 822 view_size = current_size_;
822 823
823 // Break now if we got a backing store or accelerated surface of the 824 // Break now if we got a backing store or accelerated surface of the
824 // correct size. 825 // correct size.
825 if (view_->HasAcceleratedSurface(view_size)) 826 if (view_->HasAcceleratedSurface(view_size))
826 return; 827 return;
827 } else { 828 } else {
828 TRACE_EVENT0("renderer_host", "WaitForSurface::Timeout"); 829 TRACE_EVENT0("renderer_host", "WaitForSurface::Timeout");
829 break; 830 break;
830 } 831 }
831 832
832 // Loop if we still have time left and haven't gotten a properly sized 833 // Loop if we still have time left and haven't gotten a properly sized
833 // BackingStore yet. This is necessary to support the GPU path which 834 // BackingStore yet. This is necessary to support the GPU path which
834 // typically has multiple frames pipelined -- we may need to skip one or two 835 // typically has multiple frames pipelined -- we may need to skip one or two
835 // BackingStore messages to get to the latest. 836 // BackingStore messages to get to the latest.
836 max_delay = end_time - TimeTicks::Now(); 837 elapsed_delay = TimeTicks::Now() - start_time;
837 } while (max_delay > TimeDelta::FromSeconds(0)); 838 } while (elapsed_delay < max_delay);
839
840 UMA_HISTOGRAM_CUSTOM_TIMES("OSX.RendererHost.SurfaceWaitTime", elapsed_delay,
841 TimeDelta::FromMilliseconds(1),
842 TimeDelta::FromMilliseconds(200), 50);
838 } 843 }
839 #endif 844 #endif
840 845
841 bool RenderWidgetHostImpl::ScheduleComposite() { 846 bool RenderWidgetHostImpl::ScheduleComposite() {
842 if (is_hidden_ || current_size_.IsEmpty() || repaint_ack_pending_ || 847 if (is_hidden_ || current_size_.IsEmpty() || repaint_ack_pending_ ||
843 resize_ack_pending_) { 848 resize_ack_pending_) {
844 return false; 849 return false;
845 } 850 }
846 851
847 // Send out a request to the renderer to paint the view if required. 852 // Send out a request to the renderer to paint the view if required.
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 } 2169 }
2165 #endif 2170 #endif
2166 2171
2167 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { 2172 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() {
2168 if (view_) 2173 if (view_)
2169 return view_->PreferredReadbackFormat(); 2174 return view_->PreferredReadbackFormat();
2170 return kN32_SkColorType; 2175 return kN32_SkColorType;
2171 } 2176 }
2172 2177
2173 } // namespace content 2178 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698