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

Side by Side Diff: sky/engine/core/frame/PRESUBMIT.py

Issue 867903002: Remove UseCounter (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/frame/LocalDOMWindow.cpp ('k') | sky/engine/core/frame/UseCounter.h » ('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 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 """Blink frame presubmit script 5 """Blink frame presubmit script
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
11 11
12 def _RunUseCounterChecks(input_api, output_api): 12 def CheckChangeOnUpload(input_api, output_api):
13 for f in input_api.AffectedFiles():
14 if f.LocalPath().endswith('UseCounter.cpp'):
15 useCounterCpp = f
16 break
17 else:
18 return []
19
20 largestFoundBucket = 0
21 maximumBucket = 0
22 # Looking for a line like "case CSSPropertyFoo: return 453;"
23 bucketFinder = input_api.re.compile(r'.*CSSProperty.*return\s*([0-9]+).*')
24 # Looking for a line like "static int maximumCSSSampleId() { return 452; }"
25 maximumFinder = input_api.re.compile(
26 r'static int maximumCSSSampleId\(\) { return ([0-9]+)')
27 for line in useCounterCpp.NewContents():
28 bucketMatch = bucketFinder.match(line)
29 if bucketMatch:
30 bucket = int(bucketMatch.group(1))
31 largestFoundBucket = max(largestFoundBucket, bucket)
32 else:
33 maximumMatch = maximumFinder.match(line)
34 if maximumMatch:
35 maximumBucket = int(maximumMatch.group(1))
36
37 if largestFoundBucket != maximumBucket:
38 if input_api.is_committing:
39 message_type = output_api.PresubmitError
40 else:
41 message_type = output_api.PresubmitPromptWarning
42
43 return [message_type(
44 'Largest found CSSProperty bucket Id (%d) does not match '
45 'maximumCSSSampleId (%d)' %
46 (largestFoundBucket, maximumBucket),
47 items=[useCounterCpp.LocalPath()])]
48
49 return [] 13 return []
50 14
51 15
52 def CheckChangeOnUpload(input_api, output_api):
53 return _RunUseCounterChecks(input_api, output_api)
54
55
56 def CheckChangeOnCommit(input_api, output_api): 16 def CheckChangeOnCommit(input_api, output_api):
57 return _RunUseCounterChecks(input_api, output_api) 17 return []
OLDNEW
« no previous file with comments | « sky/engine/core/frame/LocalDOMWindow.cpp ('k') | sky/engine/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698