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

Side by Side Diff: third_party/WebKit/public/platform/PRESUBMIT.py

Issue 2894063002: Expose UseCounter::Feature enum out of blink as WebFeature (Closed)
Patch Set: Initial check in Created 3 years, 7 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
OLDNEW
(Empty)
1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Blink frame presubmit script
6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl.
9 """
10
11
12 def _RunUmaHistogramChecks(input_api, output_api): # pylint: disable=C0103
Rick Byers 2017/05/23 19:51:49 Looks like this just moves the existing rule witho
lunalu1 2017/05/24 20:56:33 I did test that. But thanks for the reminder
13 import sys
14
15 original_sys_path = sys.path
16 try:
17 sys.path = sys.path + [input_api.os_path.join(
18 input_api.PresubmitLocalPath(), '..', '..', '..', '..',
19 'tools', 'metrics', 'histograms')]
20 import update_histogram_enum # pylint: disable=F0401
21 finally:
22 sys.path = original_sys_path
23
24 source_path = ''
25 for f in input_api.AffectedFiles():
26 if f.LocalPath().endswith('WebFeature.h'):
27 source_path = f.LocalPath()
28 break
29 else:
30 return []
31
32 start_marker = '^enum class WebFeature : uint32_t {'
33 end_marker = '^kNumberOfFeatures'
34 presubmit_error = update_histogram_enum.CheckPresubmitErrors(
35 histogram_enum_name='FeatureObserver',
36 update_script_name='update_use_counter_feature_enum.py',
37 source_enum_path=source_path,
38 start_marker=start_marker,
39 end_marker=end_marker,
40 strip_k_prefix=True)
41 if presubmit_error:
42 return [output_api.PresubmitPromptWarning(presubmit_error,
43 items=[source_path])]
44 return []
45
46
47 def CheckChangeOnUpload(input_api, output_api): # pylint: disable=C0103
48 results = []
49 results.extend(_RunUmaHistogramChecks(input_api, output_api))
50 return results
51
52
53 def CheckChangeOnCommit(input_api, output_api): # pylint: disable=C0103
54 results = []
55 results.extend(_RunUmaHistogramChecks(input_api, output_api))
56 return results
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698