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

Side by Side Diff: tools/skp/webpages_playback.py

Issue 1045153004: Turn on Chromium's top 25 page set (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Archives or replays webpages and creates SKPs in a Google Storage location. 6 """Archives or replays webpages and creates SKPs in a Google Storage location.
7 7
8 To archive webpages and store SKP files (archives should be rarely updated): 8 To archive webpages and store SKP files (archives should be rarely updated):
9 9
10 cd skia 10 cd skia
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 (gs_utils.GSUtils.IdType.GROUP_BY_DOMAIN, 'google.com', 114 (gs_utils.GSUtils.IdType.GROUP_BY_DOMAIN, 'google.com',
115 gs_utils.GSUtils.Permission.READ), 115 gs_utils.GSUtils.Permission.READ),
116 ] 116 ]
117 117
118 # Path to Chromium's page sets. 118 # Path to Chromium's page sets.
119 CHROMIUM_PAGE_SETS_PATH = os.path.join('tools', 'perf', 'page_sets') 119 CHROMIUM_PAGE_SETS_PATH = os.path.join('tools', 'perf', 'page_sets')
120 120
121 # Dictionary of supported Chromium page sets to their file prefixes. 121 # Dictionary of supported Chromium page sets to their file prefixes.
122 CHROMIUM_PAGE_SETS_TO_PREFIX = { 122 CHROMIUM_PAGE_SETS_TO_PREFIX = {
123 'key_mobile_sites_smooth.py': 'keymobi', 123 'key_mobile_sites_smooth.py': 'keymobi',
124 # TODO(rmistry): Uncomment the below after it is verified that the above 124 'top_25_smooth.py': 'top25desk',
125 # works.
126 # 'top_25_smooth.py': 'top25desk',
127 } 125 }
128 126
129 127
130 def remove_prefix(s, prefix): 128 def remove_prefix(s, prefix):
131 if s.startswith(prefix): 129 if s.startswith(prefix):
132 return s[len(prefix):] 130 return s[len(prefix):]
133 return s 131 return s
134 132
135 133
136 class SkPicturePlayback(object): 134 class SkPicturePlayback(object):
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 # skia_yahooanswers_desktop -> skia, yahooanswers, desktop 379 # skia_yahooanswers_desktop -> skia, yahooanswers, desktop
382 _, page_name, device = ps_basename.split('_') 380 _, page_name, device = ps_basename.split('_')
383 basename = '%s_%s' % (DEVICE_TO_PLATFORM_PREFIX[device], page_name) 381 basename = '%s_%s' % (DEVICE_TO_PLATFORM_PREFIX[device], page_name)
384 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp' 382 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp'
385 383
386 def _GetChromiumSkpFileName(self, page_set, site): 384 def _GetChromiumSkpFileName(self, page_set, site):
387 """Returns the SKP file name for Chromium page sets.""" 385 """Returns the SKP file name for Chromium page sets."""
388 # /path/to/http___mobile_news_sandbox_pt0 -> http___mobile_news_sandbox_pt0 386 # /path/to/http___mobile_news_sandbox_pt0 -> http___mobile_news_sandbox_pt0
389 _, webpage = os.path.split(site) 387 _, webpage = os.path.split(site)
390 # http___mobile_news_sandbox_pt0 -> mobile_news_sandbox_pt0 388 # http___mobile_news_sandbox_pt0 -> mobile_news_sandbox_pt0
391 if webpage.startswith('http___'): 389 for prefix in ('http___', 'https___'):
392 webpage = webpage[7:] 390 if webpage.startswith(prefix):
393 elif webpage.startswith('https___'): 391 webpage = webpage[len(prefix):]
394 webpage = webpage[8:]
395 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py 392 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py
396 ps_filename = os.path.basename(page_set) 393 ps_filename = os.path.basename(page_set)
397 # http___mobile_news_sandbox -> pagesetprefix_http___mobile_news_sandbox 394 # http___mobile_news_sandbox -> pagesetprefix_http___mobile_news_sandbox
398 basename = '%s_%s' % (CHROMIUM_PAGE_SETS_TO_PREFIX[ps_filename], webpage) 395 basename = '%s_%s' % (CHROMIUM_PAGE_SETS_TO_PREFIX[ps_filename], webpage)
399 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp' 396 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp'
400 397
401 def _RenameSkpFiles(self, page_set): 398 def _RenameSkpFiles(self, page_set):
402 """Rename generated SKP files into more descriptive names. 399 """Rename generated SKP files into more descriptive names.
403 400
404 Look into the subdirectory of TMP_SKP_DIR and find the most interesting 401 Look into the subdirectory of TMP_SKP_DIR and find the most interesting
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 default=None) 550 default=None)
554 option_parser.add_option( 551 option_parser.add_option(
555 '', '--non-interactive', action='store_true', 552 '', '--non-interactive', action='store_true',
556 help='Runs the script without any prompts. If this flag is specified and ' 553 help='Runs the script without any prompts. If this flag is specified and '
557 '--skia_tools is specified then the debugger is not run.', 554 '--skia_tools is specified then the debugger is not run.',
558 default=False) 555 default=False)
559 options, unused_args = option_parser.parse_args() 556 options, unused_args = option_parser.parse_args()
560 557
561 playback = SkPicturePlayback(options) 558 playback = SkPicturePlayback(options)
562 sys.exit(playback.Run()) 559 sys.exit(playback.Run())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698