summaryrefslogtreecommitdiffstats
path: root/tools/perf/profile_creators
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2015-10-19 15:10:53 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-19 22:12:16 +0000
commit87add3d4097fb305a41b77a617f0fb2979bf3d48 (patch)
tree9148f00270fb8560d3ca07b4f9eb39216cc976c8 /tools/perf/profile_creators
parent9ad054af6916370b5ccf143fcdea6a767e40fa8e (diff)
downloadchromium_src-87add3d4097fb305a41b77a617f0fb2979bf3d48.zip
chromium_src-87add3d4097fb305a41b77a617f0fb2979bf3d48.tar.gz
chromium_src-87add3d4097fb305a41b77a617f0fb2979bf3d48.tar.bz2
telemetry: Never reuse a generated profile.
There is currently no mechanism for determining the version of Chrome that generated a profile, nor is there a mechanism for validating the contents of a generated profile. Therefore, Telemetry should never reuse a generated profile. BUG=545127 Review URL: https://codereview.chromium.org/1419463002 Cr-Commit-Position: refs/heads/master@{#354883}
Diffstat (limited to 'tools/perf/profile_creators')
-rw-r--r--tools/perf/profile_creators/profile_generator.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/tools/perf/profile_creators/profile_generator.py b/tools/perf/profile_creators/profile_generator.py
index 4c52665..1febd44 100644
--- a/tools/perf/profile_creators/profile_generator.py
+++ b/tools/perf/profile_creators/profile_generator.py
@@ -90,19 +90,25 @@ class ProfileGenerator(object):
(e.g., crytohome on CrOS).
"""
possible_browser = browser_finder.FindBrowser(options)
- is_cros = possible_browser.browser_type.startswith('cros')
- out_dir = None
- if is_cros:
+ if possible_browser.browser_type.startswith('cros'):
self.Create(options, None)
- else:
- # Decide profile output path.
- out_dir = (options.browser_options.profile_dir or
- os.path.abspath(os.path.join(
- tempfile.gettempdir(), self._profile_name, self._profile_name)))
- if not os.path.exists(out_dir):
- self.Create(options, out_dir)
+ return None
+
+ # Use the given --profile-dir.
+ if options.browser_options.profile_dir:
+ return options.browser_options.profile_dir
+
+ out_dir = os.path.abspath(os.path.join(
+ tempfile.gettempdir(), self._profile_name, self._profile_name))
+
+ # Never reuse a generated profile, since it might be for a different version
+ # of Chrome.
+ if os.path.exists(out_dir):
+ assert os.path.isdir(out_dir)
+ shutil.rmtree(out_dir)
+ self.Create(options, out_dir)
return out_dir
def Create(self, options, out_dir):