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

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

Issue 1888343003: Clovis: contentful paint upgrades. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url-rename
Patch Set: rebase 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/test_utils.py ('k') | tools/android/loading/tracing_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/tracing.py
diff --git a/tools/android/loading/tracing.py b/tools/android/loading/tracing.py
index 068c5b6b1fa67a894f1f6b0b0df97e44ddb01c3b..55009a6384fcfecec86e8c997f84b70b8772df84 100644
--- a/tools/android/loading/tracing.py
+++ b/tools/android/loading/tracing.py
@@ -92,10 +92,26 @@ class TracingTrack(devtools_monitor.Track):
def GetMatchingMainFrameEvents(self, category, name):
"""Gets events matching |category| and |name| that occur in the main frame.
- Assumes that the events in question have a 'frame' key in their |args|."""
+
+ Events without a 'frame' key in their |args| are discarded.
+ """
matching_events = self.GetMatchingEvents(category, name)
return [e for e in matching_events
- if e.args['frame'] == self._GetMainFrameID()]
+ if 'frame' in e.args and e.args['frame'] == self.GetMainFrameID()]
+
+ def GetMainFrameID(self):
+ """Returns the main frame ID."""
+ if not self._main_frame_id:
+ navigation_start_events = [e for e in self.GetEvents()
+ if e.Matches('blink.user_timing', 'navigationStart')]
+ first_event = min(navigation_start_events, key=lambda e: e.start_msec)
+ self._main_frame_id = first_event.args['frame']
+
+ return self._main_frame_id
+
+ def SetMainFrameID(self, frame_id):
+ """Set the main frame ID. Normally this is used only for testing."""
+ self._main_frame_id = frame_id
def EventsAt(self, msec):
"""Gets events active at a timestamp.
@@ -197,16 +213,6 @@ class TracingTrack(devtools_monitor.Track):
return event
return None
- def _GetMainFrameID(self):
- """Returns the main frame ID."""
- if not self._main_frame_id:
- navigation_start_events = [e for e in self.GetEvents()
- if e.Matches('blink.user_timing', 'navigationStart')]
- first_event = min(navigation_start_events, key=lambda e: e.start_msec)
- self._main_frame_id = first_event.args['frame']
-
- return self._main_frame_id
-
def _IndexEvents(self, strict=False):
if self._interval_tree:
return
« no previous file with comments | « tools/android/loading/test_utils.py ('k') | tools/android/loading/tracing_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698