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

Side by Side Diff: tools/perf/profile_creators/profile_generator.py

Issue 1881573002: [Perf] Guard against impending output_profile_path option move. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « tools/perf/profile_creators/profile_extender.py ('k') | 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Handles generating profiles and transferring them to/from mobile devices.""" 5 """Handles generating profiles and transferring them to/from mobile devices."""
6 6
7 import logging 7 import logging
8 import optparse 8 import optparse
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 # Leave the global options intact. 125 # Leave the global options intact.
126 creator_options = options.Copy() 126 creator_options = options.Copy()
127 127
128 if out_dir: 128 if out_dir:
129 sys.stderr.write('Generating profile to: %s \n' % out_dir) 129 sys.stderr.write('Generating profile to: %s \n' % out_dir)
130 # The genrated profile is copied to out_dir only if the generation is 130 # The genrated profile is copied to out_dir only if the generation is
131 # successful. In the generation process a temp directory is used so 131 # successful. In the generation process a temp directory is used so
132 # the default profile is not polluted on failure. 132 # the default profile is not polluted on failure.
133 tmp_profile_path = tempfile.mkdtemp() 133 tmp_profile_path = tempfile.mkdtemp()
134 creator_options.output_profile_path = tmp_profile_path 134 # TODO(eakuefner): Remove this after crrev.com/1874473006 rolls in.
135 try:
136 getattr(creator_options, 'output_profile_path')
137 creator_options.output_profile_path = tmp_profile_path
138 except AttributeError:
139 creator_options.browser_options.output_profile_path = tmp_profile_path
135 140
136 creator = self._profile_extender_class(creator_options) 141 creator = self._profile_extender_class(creator_options)
137 142
138 try: 143 try:
139 creator.Run() 144 creator.Run()
140 except Exception as e: 145 except Exception as e:
141 logging.exception('Profile creation failed.') 146 logging.exception('Profile creation failed.')
142 raise e 147 raise e
143 else: 148 else:
144 sys.stderr.write('SUCCESS: Profile generated.\n') 149 sys.stderr.write('SUCCESS: Profile generated.\n')
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 ProcessCommandLineArgs(parser, options) 207 ProcessCommandLineArgs(parser, options)
203 208
204 # Generate profile. 209 # Generate profile.
205 profile_extenders = _DiscoverProfileExtenderClasses() 210 profile_extenders = _DiscoverProfileExtenderClasses()
206 profile_extender_class = profile_extenders[options.profile_type_to_generate] 211 profile_extender_class = profile_extenders[options.profile_type_to_generate]
207 212
208 generator = ProfileGenerator(profile_extender_class, 213 generator = ProfileGenerator(profile_extender_class,
209 options.profile_type_to_generate) 214 options.profile_type_to_generate)
210 generator.Create(options, options.output_dir) 215 generator.Create(options, options.output_dir)
211 return 0 216 return 0
OLDNEW
« no previous file with comments | « tools/perf/profile_creators/profile_extender.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698