OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 import logging | |
4 import os | 5 import os |
6 import tempfile | |
5 | 7 |
6 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
7 | 9 |
8 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");' | 10 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");' |
9 | 11 |
10 class SkPicturePrinter(page_measurement.PageMeasurement): | 12 class SkPicturePrinter(page_measurement.PageMeasurement): |
11 def AddCommandLineOptions(self, parser): | 13 def AddCommandLineOptions(self, parser): |
12 parser.add_option('-o', '--outdir', help='Output directory') | 14 parser.add_option('-s', '--skp-outdir', |
15 help='Output directory for the SKP files') | |
13 | 16 |
14 def CustomizeBrowserOptions(self, options): | 17 def CustomizeBrowserOptions(self, options): |
15 options.extra_browser_args.extend(['--enable-gpu-benchmarking', | 18 options.extra_browser_args.extend(['--enable-gpu-benchmarking', |
16 '--no-sandbox']) | 19 '--no-sandbox', |
20 '--enable-deferred-image-decoding', | |
21 '--force-compositing-mode']) | |
17 | 22 |
18 def MeasurePage(self, page, tab, results): | 23 def MeasurePage(self, page, tab, results): |
19 if self.options.outdir is not None: | 24 skp_outdir = self.options.skp-outdir |
dtu
2013/05/28 21:35:55
Sorry, the variable name is still skp_outdir, the
rmistry
2013/05/28 21:41:32
I should change it back to skp_outdir then?
| |
20 outpath = os.path.join(self.options.outdir, page.url_as_file_safe_name) | 25 if not skp_outdir: |
21 outpath = os.path.abspath(outpath) | 26 skp_outdir = tempfile.gettempdir() |
27 logging.warning('--skp-outdir has not been specified, outputting to ' | |
28 '%s instead.' % skp_outdir) | |
29 outpath = os.path.abspath( | |
30 os.path.join(skp_outdir, | |
31 page.url_as_file_safe_name)) | |
22 # Replace win32 path separator char '\' with '\\'. | 32 # Replace win32 path separator char '\' with '\\'. |
23 js = _JS.format(outpath.replace('\\', '\\\\')) | 33 js = _JS.format(outpath.replace('\\', '\\\\')) |
24 tab.EvaluateJavaScript(js) | 34 tab.EvaluateJavaScript(js) |
25 results.Add('output_path', 'path', outpath) | 35 results.Add('output_path', 'path', outpath) |
OLD | NEW |