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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_instrumenting_probes.py

Issue 2846723003: Removed local RefPtr created from PassRefPtr arg in generated file. (Closed)
Patch Set: Addressed comments. 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl » ('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 2017 The Chromium Authors. All rights reserved. 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 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 ast 5 import ast
6 import optparse 6 import optparse
7 import os.path 7 import os.path
8 import re 8 import re
9 import sys 9 import sys
10 10
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 min_type_tokens = 2 if re.match("(const|unsigned long) ", param_decl) el se 1 148 min_type_tokens = 2 if re.match("(const|unsigned long) ", param_decl) el se 1
149 149
150 if len(param_decl.split(" ")) > min_type_tokens: 150 if len(param_decl.split(" ")) > min_type_tokens:
151 parts = param_decl.split(" ") 151 parts = param_decl.split(" ")
152 self.type = " ".join(parts[:-1]) 152 self.type = " ".join(parts[:-1])
153 self.name = parts[-1] 153 self.name = parts[-1]
154 else: 154 else:
155 self.type = param_decl 155 self.type = param_decl
156 self.name = build_param_name(self.type) 156 self.name = build_param_name(self.type)
157 157
158 self.value = self.name
159 self.is_prp = re.match(r"PassRefPtr<", param_decl) is not None
160 if self.is_prp:
161 self.name = "prp" + self.name[0].upper() + self.name[1:]
162 self.inner_type = re.match(r"PassRefPtr<(.+)>", param_decl).group(1)
163
164 if self.type[-1] == "*" and "char" not in self.type: 158 if self.type[-1] == "*" and "char" not in self.type:
165 self.member_type = "Member<%s>" % self.type[:-1] 159 self.member_type = "Member<%s>" % self.type[:-1]
166 else: 160 else:
167 self.member_type = self.type 161 self.member_type = self.type
168 162
169 163
170 def build_param_name(param_type): 164 def build_param_name(param_type):
171 base_name = re.match(r"(const |PassRefPtr<)?(\w*)", param_type).group(2) 165 return "param" + re.match(r"(const |RefPtr<)?(\w*)", param_type).group(2)
172 return "param" + base_name
173 166
174 167
175 def load_config(file_name): 168 def load_config(file_name):
176 default_config = { 169 default_config = {
177 "settings": {}, 170 "settings": {},
178 "observers": {} 171 "observers": {}
179 } 172 }
180 if not file_name: 173 if not file_name:
181 return default_config 174 return default_config
182 with open(file_name) as config_file: 175 with open(file_name) as config_file:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 sink_h_file = open(output_dirpath + "/" + to_singular(base_name) + "Sink.h", "w" ) 252 sink_h_file = open(output_dirpath + "/" + to_singular(base_name) + "Sink.h", "w" )
260 sink_h_file.write(sink_h_template.render(template_context)) 253 sink_h_file.write(sink_h_template.render(template_context))
261 sink_h_file.close() 254 sink_h_file.close()
262 255
263 for f in files: 256 for f in files:
264 template_context["file"] = f 257 template_context["file"] = f
265 h_template = jinja_env.get_template("/InstrumentingProbesInl.h.tmpl") 258 h_template = jinja_env.get_template("/InstrumentingProbesInl.h.tmpl")
266 h_file = open(output_dirpath + "/" + f.header_name + ".h", "w") 259 h_file = open(output_dirpath + "/" + f.header_name + ".h", "w")
267 h_file.write(h_template.render(template_context)) 260 h_file.write(h_template.render(template_context))
268 h_file.close() 261 h_file.close()
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698