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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py

Issue 2214193002: [DevTools] Introduce unserializableValue in RemoteObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hidden Created 4 years, 4 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
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 os.path 5 import os.path
6 import sys 6 import sys
7 import optparse 7 import optparse
8 try: 8 try:
9 import json 9 import json
10 except ImportError: 10 except ImportError:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if generated_ts < template_ts: 125 if generated_ts < template_ts:
126 return False 126 return False
127 return True 127 return True
128 128
129 129
130 def to_title_case(name): 130 def to_title_case(name):
131 return name[:1].upper() + name[1:] 131 return name[:1].upper() + name[1:]
132 132
133 133
134 def dash_to_camelcase(word): 134 def dash_to_camelcase(word):
135 return "".join(to_title_case(x) or "-" for x in word.split("-")) 135 prefix = ""
136 if word[0] == "-":
137 prefix = "Negative"
138 word = word[1:]
139 return prefix + "".join(to_title_case(x) or "-" for x in word.split("-"))
136 140
137 141
138 def initialize_jinja_env(cache_dir): 142 def initialize_jinja_env(cache_dir):
139 jinja_env = jinja2.Environment( 143 jinja_env = jinja2.Environment(
140 loader=jinja2.FileSystemLoader(templates_dir), 144 loader=jinja2.FileSystemLoader(templates_dir),
141 # Bytecode cache is not concurrency-safe unless pre-cached: 145 # Bytecode cache is not concurrency-safe unless pre-cached:
142 # if pre-cached this is read-only, but writing creates a race condition. 146 # if pre-cached this is read-only, but writing creates a race condition.
143 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), 147 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir),
144 keep_trailing_newline=True, # newline-terminate generated files 148 keep_trailing_newline=True, # newline-terminate generated files
145 lstrip_blocks=True, # so can indent control flow tags 149 lstrip_blocks=True, # so can indent control flow tags
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 427
424 for domain in json_api["domains"]: 428 for domain in json_api["domains"]:
425 class_name = domain["domain"] 429 class_name = domain["domain"]
426 if domain["domain"] in generate_domains: 430 if domain["domain"] in generate_domains:
427 generate(domain, h_template, output_dirname + "/" + class_name + ".h") 431 generate(domain, h_template, output_dirname + "/" + class_name + ".h")
428 generate(domain, cpp_template, output_dirname + "/" + class_name + ".cpp ") 432 generate(domain, cpp_template, output_dirname + "/" + class_name + ".cpp ")
429 if domain["has_exports"]: 433 if domain["has_exports"]:
430 generate(domain, exported_template, exported_dirname + "/" + class_n ame + ".h") 434 generate(domain, exported_template, exported_dirname + "/" + class_n ame + ".h")
431 if domain["domain"] in include_domains and domain["has_exports"]: 435 if domain["domain"] in include_domains and domain["has_exports"]:
432 generate(domain, imported_template, output_dirname + "/" + class_name + ".h") 436 generate(domain, imported_template, output_dirname + "/" + class_name + ".h")
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698