OLD | NEW |
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 string | 7 import string |
8 import optparse | 8 import optparse |
9 import re | 9 import re |
10 try: | 10 try: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 "to_pass_type": "%s.release()", | 108 "to_pass_type": "%s.release()", |
109 "type": "OwnPtr<protocol::%s::%s>" % (domain_name, type["id"]), | 109 "type": "OwnPtr<protocol::%s::%s>" % (domain_name, type["id"]), |
110 "raw_type": "protocol::%s::%s" % (domain_name, type["id"]), | 110 "raw_type": "protocol::%s::%s" % (domain_name, type["id"]), |
111 "raw_pass_type": "protocol::%s::%s*" % (domain_name, type["id"]), | 111 "raw_pass_type": "protocol::%s::%s*" % (domain_name, type["id"]), |
112 "raw_return_type": "protocol::%s::%s*" % (domain_name, type["id"]), | 112 "raw_return_type": "protocol::%s::%s*" % (domain_name, type["id"]), |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 def create_object_type_definition(): | 116 def create_object_type_definition(): |
117 return { | 117 return { |
118 "return_type": "PassRefPtr<JSONObject>", | 118 "return_type": "PassRefPtr<protocol::DictionaryValue>", |
119 "pass_type": "PassRefPtr<JSONObject>", | 119 "pass_type": "PassRefPtr<protocol::DictionaryValue>", |
120 "to_raw_type": "%s", | 120 "to_raw_type": "%s", |
121 "to_pass_type": "%s.release()", | 121 "to_pass_type": "%s.release()", |
122 "type": "RefPtr<JSONObject>", | 122 "type": "RefPtr<protocol::DictionaryValue>", |
123 "raw_type": "RefPtr<JSONObject>", | 123 "raw_type": "RefPtr<protocol::DictionaryValue>", |
124 "raw_pass_type": "PassRefPtr<JSONObject>", | 124 "raw_pass_type": "PassRefPtr<protocol::DictionaryValue>", |
125 "raw_return_type": "RefPtr<JSONObject>", | 125 "raw_return_type": "RefPtr<protocol::DictionaryValue>", |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 def create_any_type_definition(): | 129 def create_any_type_definition(): |
130 return { | 130 return { |
131 "return_type": "PassRefPtr<JSONValue>", | 131 "return_type": "PassRefPtr<protocol::Value>", |
132 "pass_type": "PassRefPtr<JSONValue>", | 132 "pass_type": "PassRefPtr<protocol::Value>", |
133 "to_pass_type": "%s.release()", | 133 "to_pass_type": "%s.release()", |
134 "to_raw_type": "%s", | 134 "to_raw_type": "%s", |
135 "type": "RefPtr<JSONValue>", | 135 "type": "RefPtr<protocol::Value>", |
136 "raw_type": "RefPtr<JSONValue>", | 136 "raw_type": "RefPtr<protocol::Value>", |
137 "raw_pass_type": "PassRefPtr<JSONValue>", | 137 "raw_pass_type": "PassRefPtr<protocol::Value>", |
138 "raw_return_type": "RefPtr<JSONValue>", | 138 "raw_return_type": "RefPtr<protocol::Value>", |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 def create_primitive_type_definition(type): | 142 def create_primitive_type_definition(type): |
143 if type == "string": | 143 if type == "string": |
144 return { | 144 return { |
145 "return_type": "String", | 145 "return_type": "String", |
146 "pass_type": "const String&", | 146 "pass_type": "const String&", |
147 "to_pass_type": "%s", | 147 "to_pass_type": "%s", |
148 "to_raw_type": "%s", | 148 "to_raw_type": "%s", |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 h_file.write(h_template.render(template_context)) | 249 h_file.write(h_template.render(template_context)) |
250 cpp_file.write(cpp_template.render(template_context)) | 250 cpp_file.write(cpp_template.render(template_context)) |
251 h_file.close() | 251 h_file.close() |
252 cpp_file.close() | 252 cpp_file.close() |
253 | 253 |
254 | 254 |
255 jinja_env = initialize_jinja_env(output_dirname) | 255 jinja_env = initialize_jinja_env(output_dirname) |
256 generate("Dispatcher") | 256 generate("Dispatcher") |
257 generate("Frontend") | 257 generate("Frontend") |
258 generate("TypeBuilder") | 258 generate("TypeBuilder") |
OLD | NEW |