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

Unified Diff: tools/android/loading/user_satisfied_lens.py

Issue 1924453002: clovis: Enable the disable-by-default-blink.debug.layout tracing category. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/android/loading/tracing.py ('k') | tools/android/loading/user_satisfied_lens_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/user_satisfied_lens.py
diff --git a/tools/android/loading/user_satisfied_lens.py b/tools/android/loading/user_satisfied_lens.py
index 89ce7a1ca5120c3a03eccf2ac39d4f62e0dc47e0..dd99d79a3a8b57a444670ecdf20f6c4e82cfb29c 100644
--- a/tools/android/loading/user_satisfied_lens.py
+++ b/tools/android/loading/user_satisfied_lens.py
@@ -91,6 +91,11 @@ class _FirstEventLens(_UserSatisfiedLens):
# pylint: disable=abstract-method
@classmethod
+ def _CheckCategory(cls, tracing_track, category):
+ assert category in tracing_track.Categories(), (
+ 'The "%s" category must be enabled.' % category)
+
+ @classmethod
def _ExtractFirstTiming(cls, times):
if not times:
return float('inf')
@@ -106,9 +111,11 @@ class FirstTextPaintLens(_FirstEventLens):
This event is taken directly from a trace.
"""
+ _EVENT_CATEGORY = 'blink.user_timing'
def _CalculateTimes(self, tracing_track):
+ self._CheckCategory(tracing_track, self._EVENT_CATEGORY)
first_paints = [e.start_msec for e in tracing_track.GetEvents()
- if e.Matches('blink.user_timing', 'firstPaint')]
+ if e.Matches(self._EVENT_CATEGORY, 'firstPaint')]
self._satisfied_msec = self._event_msec = \
self._ExtractFirstTiming(first_paints)
@@ -119,9 +126,11 @@ class FirstContentfulPaintLens(_FirstEventLens):
This event is taken directly from a trace. Internally to chrome it's computed
by filtering out things like background paint from firstPaint.
"""
+ _EVENT_CATEGORY = 'blink.user_timing'
def _CalculateTimes(self, tracing_track):
+ self._CheckCategory(tracing_track, self._EVENT_CATEGORY)
first_paints = [e.start_msec for e in tracing_track.GetEvents()
- if e.Matches('blink.user_timing', 'firstContentfulPaint')]
+ if e.Matches(self._EVENT_CATEGORY, 'firstContentfulPaint')]
self._satisfied_msec = self._event_msec = \
self._ExtractFirstTiming(first_paints)
@@ -133,22 +142,22 @@ class FirstSignificantPaintLens(_FirstEventLens):
been loaded to compute the layout. Our event time is that of the next paint as
that is the observable event.
"""
- FIRST_LAYOUT_COUNTER = 'LayoutObjectsThatHadNeverHadLayout'
-
+ _FIRST_LAYOUT_COUNTER = 'LayoutObjectsThatHadNeverHadLayout'
+ _EVENT_CATEGORY = 'disabled-by-default-blink.debug.layout'
def _CalculateTimes(self, tracing_track):
+ self._CheckCategory(tracing_track, self._EVENT_CATEGORY)
sync_paint_times = []
layouts = [] # (layout item count, msec).
for e in tracing_track.GetEvents():
# TODO(mattcary): is this the right paint event? Check if synchronized
# paints appear at the same time as the first*Paint events, above.
- if e.Matches('blink', 'FrameView::SynchronizedPaint'):
+ if e.Matches('blink', 'FrameView::synchronizedPaint'):
sync_paint_times.append(e.start_msec)
if ('counters' in e.args and
- self.FIRST_LAYOUT_COUNTER in e.args['counters']):
- layouts.append((e.args['counters'][self.FIRST_LAYOUT_COUNTER],
+ self._FIRST_LAYOUT_COUNTER in e.args['counters']):
+ layouts.append((e.args['counters'][self._FIRST_LAYOUT_COUNTER],
e.start_msec))
- assert layouts, ('No layout events, was the disabled-by-default-blink'
- '.debug.layout category enabled?')
+ assert layouts, 'No layout events'
layouts.sort(key=operator.itemgetter(0), reverse=True)
self._satisfied_msec = layouts[0][1]
self._event_msec = self._ExtractFirstTiming([
« no previous file with comments | « tools/android/loading/tracing.py ('k') | tools/android/loading/user_satisfied_lens_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698