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

Side by Side Diff: tools/android/loading/request_track.py

Issue 2112013003: sandwich: Use cachetool's batch mode to speed-up cache processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@af00
Patch Set: s/Online/Batch Created 4 years, 5 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 | « tools/android/loading/chrome_cache.py ('k') | tools/android/loading/sandwich_prefetch.py » ('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) 2016 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2016 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 """The request data track. 5 """The request data track.
6 6
7 When executed, parses a JSON dump of DevTools messages. 7 When executed, parses a JSON dump of DevTools messages.
8 """ 8 """
9 9
10 import bisect 10 import bisect
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 r.data_chunks.append((offset, params['encodedDataLength'])) 809 r.data_chunks.append((offset, params['encodedDataLength']))
810 self._requests_in_flight[request_id] = (r, RequestTrack._STATUS_DATA) 810 self._requests_in_flight[request_id] = (r, RequestTrack._STATUS_DATA)
811 811
812 def _LoadingFinished(self, request_id, params): 812 def _LoadingFinished(self, request_id, params):
813 if request_id not in self._requests_in_flight: 813 if request_id not in self._requests_in_flight:
814 return 814 return
815 (r, status) = self._requests_in_flight[request_id] 815 (r, status) = self._requests_in_flight[request_id]
816 assert (status == RequestTrack._STATUS_RESPONSE 816 assert (status == RequestTrack._STATUS_RESPONSE
817 or status == RequestTrack._STATUS_DATA) 817 or status == RequestTrack._STATUS_DATA)
818 r.encoded_data_length = params['encodedDataLength'] 818 r.encoded_data_length = params['encodedDataLength']
819 assert (r.encoded_data_length > 0 or r.protocol == 'about' or 819 assert (r.encoded_data_length > 0 or r.protocol in {'about', 'blob'} or
820 r.from_disk_cache or r.served_from_cache) 820 r.from_disk_cache or r.served_from_cache)
821 r.timing.loading_finished = r._TimestampOffsetFromStartMs( 821 r.timing.loading_finished = r._TimestampOffsetFromStartMs(
822 params['timestamp']) 822 params['timestamp'])
823 self._requests_in_flight[request_id] = (r, RequestTrack._STATUS_FINISHED) 823 self._requests_in_flight[request_id] = (r, RequestTrack._STATUS_FINISHED)
824 self._FinalizeRequest(request_id) 824 self._FinalizeRequest(request_id)
825 825
826 def _LoadingFailed(self, request_id, params): 826 def _LoadingFailed(self, request_id, params):
827 if request_id not in self._requests_in_flight: 827 if request_id not in self._requests_in_flight:
828 logging.warning('An unknown request failed: %s' % request_id) 828 logging.warning('An unknown request failed: %s' % request_id)
829 return 829 return
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 862
863 863
864 if __name__ == '__main__': 864 if __name__ == '__main__':
865 import json 865 import json
866 import sys 866 import sys
867 events = json.load(open(sys.argv[1], 'r')) 867 events = json.load(open(sys.argv[1], 'r'))
868 request_track = RequestTrack(None) 868 request_track = RequestTrack(None)
869 for event in events: 869 for event in events:
870 event_method = event['method'] 870 event_method = event['method']
871 request_track.Handle(event_method, event) 871 request_track.Handle(event_method, event)
OLDNEW
« no previous file with comments | « tools/android/loading/chrome_cache.py ('k') | tools/android/loading/sandwich_prefetch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698