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

Side by Side Diff: third_party/polymer/v1_0/find_unused_elements.py

Issue 2352293002: MD History: Replace app-route with a custom router (Closed)
Patch Set: Delete stray newline 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/test/data/webui/md_history/history_routing_test.js ('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 #!/usr/bin/python2 1 #!/usr/bin/python2
2 2
3 # Copyright 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Identifies Polymer elements that downloaded but not used by Chrome. 7 """Identifies Polymer elements that downloaded but not used by Chrome.
8 8
9 Only finds "first-order" unused elements; re-run after removing unused elements 9 Only finds "first-order" unused elements; re-run after removing unused elements
10 to check if other elements have become unused. 10 to check if other elements have become unused.
11 """ 11 """
12 12
13 import os 13 import os
14 import re 14 import re
15 import subprocess 15 import subprocess
16 16
17 17
18 class UnusedElementsDetector(object): 18 class UnusedElementsDetector(object):
19 """Finds unused Polymer elements.""" 19 """Finds unused Polymer elements."""
20 20
21 # Unused elements to ignore because we plan to use them soon. 21 # Unused elements to ignore because we plan to use them soon.
22 __WHITELIST = ( 22 __WHITELIST = (
23 # Necessary for closure. 23 # Necessary for closure.
24 'polymer-externs', 24 'polymer-externs',
25 # TODO(tsergeant): Remove app-route from Chromium.
26 'app-route',
25 ) 27 )
26 28
27 def __init__(self): 29 def __init__(self):
28 polymer_dir = os.path.dirname(os.path.realpath(__file__)) 30 polymer_dir = os.path.dirname(os.path.realpath(__file__))
29 self.__COMPONENTS_DIR = os.path.join(polymer_dir, 'components-chromium') 31 self.__COMPONENTS_DIR = os.path.join(polymer_dir, 'components-chromium')
30 32
31 @staticmethod 33 @staticmethod
32 def __StripHtmlComments(filename): 34 def __StripHtmlComments(filename):
33 """Returns the contents of an HTML file with <!-- --> comments stripped. 35 """Returns the contents of an HTML file with <!-- --> comments stripped.
34 36
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 # scripts). 151 # scripts).
150 if re.search('/%s' % element_dir, 152 if re.search('/%s' % element_dir,
151 self.__StripComments( 153 self.__StripComments(
152 os.path.join(dirpath, filename))): 154 os.path.join(dirpath, filename))):
153 return True 155 return True
154 return False 156 return False
155 157
156 158
157 if __name__ == '__main__': 159 if __name__ == '__main__':
158 UnusedElementsDetector().Run() 160 UnusedElementsDetector().Run()
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_history/history_routing_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698