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

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: Use new frame detection 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
Index: tools/android/loading/tracing.py
diff --git a/tools/android/loading/tracing.py b/tools/android/loading/tracing.py
index c1ecf7155adaef9292e99ffb74809d1924e50a82..6055a95ae20b15d330efae6bb2470d2b4b7d6f42 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

Powered by Google App Engine
This is Rietveld 408576698