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

Side by Side Diff: chrome/browser/resources/md_history/PRESUBMIT.py

Issue 2264983002: MD History: Lazily load element files which are not needed for first paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove flattenhtml, rebase Created 4 years, 3 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 | « chrome/browser/browser_resources.grd ('k') | chrome/browser/resources/md_history/app.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import os.path 5 import os.path
6 import time 6 import time
7 7
8 def CheckChangeOnUpload(input_api, output_api): 8 def CheckChangeOnUpload(input_api, output_api):
9 """Warn when changing md_history without vulcanizing.""" 9 """Warn when changing md_history without vulcanizing."""
10 10
11 def _is_md_history_file(path): 11 def _is_md_history_file(path):
12 return (path.startswith('chrome/browser/resources/md_history') and 12 return (path.startswith('chrome/browser/resources/md_history') and
13 (not path.endswith('externs.js')) and 13 (not path.endswith('externs.js')) and
14 (not path.endswith('app.crisper.js')) and 14 (not path.endswith('crisper.js')) and
15 (not path.endswith('app.vulcanized.html')) and 15 (not path.endswith('vulcanized.html')) and
16 (path.endswith('js') or path.endswith('html'))) 16 (path.endswith('js') or path.endswith('html')))
17 17
18 def _affects_file(filename, paths):
19 return any([filename in path for path in paths])
20
21 paths = [x.LocalPath() for x in input_api.change.AffectedFiles()] 18 paths = [x.LocalPath() for x in input_api.change.AffectedFiles()]
22 earliest_vulcanize_change = min(os.path.getmtime(x) for x in 19 earliest_vulcanize_change = min(os.path.getmtime(x) for x in
23 ['app.vulcanized.html', 'app.crisper.js']) 20 ['app.vulcanized.html',
21 'app.crisper.js',
22 'lazy_load.vulcanized.html',
23 'lazy_load.crisper.js'])
24 history_changes = filter(_is_md_history_file, paths) 24 history_changes = filter(_is_md_history_file, paths)
25 latest_history_change = 0 25 latest_history_change = 0
26 if history_changes: 26 if history_changes:
27 latest_history_change = max(os.path.getmtime(os.path.split(x)[1]) for x in 27 latest_history_change = max(os.path.getmtime(os.path.split(x)[1]) for x in
28 history_changes) 28 history_changes)
29 29
30 if latest_history_change > earliest_vulcanize_change: 30 if latest_history_change > earliest_vulcanize_change:
31 return [output_api.PresubmitPromptWarning( 31 return [output_api.PresubmitPromptWarning(
32 'Vulcanize must be run when changing files in md_history. See ' 32 'Vulcanize must be run when changing files in md_history. See '
33 'docs/vulcanize.md.')] 33 'docs/vulcanize.md.')]
34 return [] 34 return []
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/resources/md_history/app.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698