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

Unified Diff: core/frame/PRESUBMIT.py

Issue 540533002: Roll IDL to Dartium37 (r181268) (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/frame/NavigatorOnLine.idl ('k') | core/frame/Screen.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/frame/PRESUBMIT.py
diff --git a/core/frame/PRESUBMIT.py b/core/frame/PRESUBMIT.py
new file mode 100644
index 0000000000000000000000000000000000000000..eba4c2f66424070ec1a33f4ddb8ae72efd61c7ba
--- /dev/null
+++ b/core/frame/PRESUBMIT.py
@@ -0,0 +1,57 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Blink frame presubmit script
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details about the presubmit API built into gcl.
+"""
+
+
+def _RunUseCounterChecks(input_api, output_api):
+ for f in input_api.AffectedFiles():
+ if f.LocalPath().endswith('UseCounter.cpp'):
+ useCounterCpp = f
+ break
+ else:
+ return []
+
+ largestFoundBucket = 0
+ maximumBucket = 0
+ # Looking for a line like "case CSSPropertyGrid: return 453;"
+ bucketFinder = input_api.re.compile(r'.*CSSProperty.*return\s*([0-9]+).*')
+ # Looking for a line like "static int maximumCSSSampleId() { return 452; }"
+ maximumFinder = input_api.re.compile(
+ r'static int maximumCSSSampleId\(\) { return ([0-9]+)')
+ for line in useCounterCpp.NewContents():
+ bucketMatch = bucketFinder.match(line)
+ if bucketMatch:
+ bucket = int(bucketMatch.group(1))
+ largestFoundBucket = max(largestFoundBucket, bucket)
+ else:
+ maximumMatch = maximumFinder.match(line)
+ if maximumMatch:
+ maximumBucket = int(maximumMatch.group(1))
+
+ if largestFoundBucket != maximumBucket:
+ if input_api.is_committing:
+ message_type = output_api.PresubmitError
+ else:
+ message_type = output_api.PresubmitPromptWarning
+
+ return [message_type(
+ 'Largest found CSSProperty bucket Id (%d) does not match '
+ 'maximumCSSSampleId (%d)' %
+ (largestFoundBucket, maximumBucket),
+ items=[useCounterCpp.LocalPath()])]
+
+ return []
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ return _RunUseCounterChecks(input_api, output_api)
+
+
+def CheckChangeOnCommit(input_api, output_api):
+ return _RunUseCounterChecks(input_api, output_api)
« no previous file with comments | « core/frame/NavigatorOnLine.idl ('k') | core/frame/Screen.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698