| OLD | NEW |
| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 'galaxynexus': 'mobi', | 95 'galaxynexus': 'mobi', |
| 96 'nexus10': 'tabl' | 96 'nexus10': 'tabl' |
| 97 } | 97 } |
| 98 | 98 |
| 99 # How many times the record_wpr binary should be retried. | 99 # How many times the record_wpr binary should be retried. |
| 100 RETRY_RECORD_WPR_COUNT = 5 | 100 RETRY_RECORD_WPR_COUNT = 5 |
| 101 # How many times the run_benchmark binary should be retried. | 101 # How many times the run_benchmark binary should be retried. |
| 102 RETRY_RUN_MEASUREMENT_COUNT = 5 | 102 RETRY_RUN_MEASUREMENT_COUNT = 5 |
| 103 | 103 |
| 104 # Location of the credentials.json file in Google Storage. | 104 # Location of the credentials.json file in Google Storage. |
| 105 CREDENTIALS_GS_PATH = '/playback/credentials/credentials.json' | 105 CREDENTIALS_GS_PATH = 'playback/credentials/credentials.json' |
| 106 | 106 |
| 107 X11_DISPLAY = os.getenv('DISPLAY', ':0') | 107 X11_DISPLAY = os.getenv('DISPLAY', ':0') |
| 108 | 108 |
| 109 # Path to Chromium's page sets. | 109 # Path to Chromium's page sets. |
| 110 CHROMIUM_PAGE_SETS_PATH = os.path.join('tools', 'perf', 'page_sets') | 110 CHROMIUM_PAGE_SETS_PATH = os.path.join('tools', 'perf', 'page_sets') |
| 111 | 111 |
| 112 # Dictionary of supported Chromium page sets to their file prefixes. | 112 # Dictionary of supported Chromium page sets to their file prefixes. |
| 113 CHROMIUM_PAGE_SETS_TO_PREFIX = { | 113 CHROMIUM_PAGE_SETS_TO_PREFIX = { |
| 114 'key_mobile_sites_smooth.py': 'keymobi', | 114 'key_mobile_sites_smooth.py': 'keymobi', |
| 115 'top_25_smooth.py': 'top25desk', | 115 'top_25_smooth.py': 'top25desk', |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 473 |
| 474 def target_type(self): | 474 def target_type(self): |
| 475 return 'Google Storage' | 475 return 'Google Storage' |
| 476 | 476 |
| 477 def does_storage_object_exist(self, name): | 477 def does_storage_object_exist(self, name): |
| 478 try: | 478 try: |
| 479 output = subprocess.check_output([ | 479 output = subprocess.check_output([ |
| 480 'gsutil', 'ls', '/'.join((self._url, name))]) | 480 'gsutil', 'ls', '/'.join((self._url, name))]) |
| 481 except subprocess.CalledProcessError: | 481 except subprocess.CalledProcessError: |
| 482 return False | 482 return False |
| 483 if len(output.splitlines) != 1: | 483 if len(output.splitlines()) != 1: |
| 484 return False | 484 return False |
| 485 return True | 485 return True |
| 486 | 486 |
| 487 def delete_path(self, path): | 487 def delete_path(self, path): |
| 488 subprocess.check_call(['gsutil', 'rm', '-r', path]) | 488 subprocess.check_call(['gsutil', 'rm', '-r', path]) |
| 489 | 489 |
| 490 def download_file(self, name, local_path): | 490 def download_file(self, name, local_path): |
| 491 subprocess.check_call([ | 491 subprocess.check_call([ |
| 492 'gsutil', 'cp', '/'.join((self._url, name)), local_path]) | 492 'gsutil', 'cp', '/'.join((self._url, name)), local_path]) |
| 493 | 493 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 '--skia_tools is specified then the debugger is not run.', | 585 '--skia_tools is specified then the debugger is not run.', |
| 586 default=False) | 586 default=False) |
| 587 option_parser.add_option( | 587 option_parser.add_option( |
| 588 '', '--skp_prefix', | 588 '', '--skp_prefix', |
| 589 help='Prefix to add to the names of generated SKPs.', | 589 help='Prefix to add to the names of generated SKPs.', |
| 590 default=None) | 590 default=None) |
| 591 options, unused_args = option_parser.parse_args() | 591 options, unused_args = option_parser.parse_args() |
| 592 | 592 |
| 593 playback = SkPicturePlayback(options) | 593 playback = SkPicturePlayback(options) |
| 594 sys.exit(playback.Run()) | 594 sys.exit(playback.Run()) |
| OLD | NEW |