OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import sys | 6 import sys |
7 import string | 7 import string |
8 import json | 8 import json |
9 | 9 |
10 blink_protocol_path = sys.argv[1] | 10 blink_protocol_path = sys.argv[1] |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 item_raw_type = items_map["raw_type"], | 561 item_raw_type = items_map["raw_type"], |
562 item_pass = items_map["pass_template"].substitute(name="item", opt=""), | 562 item_pass = items_map["pass_template"].substitute(name="item", opt=""), |
563 ItemType = items_map["Type"]) | 563 ItemType = items_map["Type"]) |
564 mapping["arg_out"] = "&out_%s" % mapping["param"] | 564 mapping["arg_out"] = "&out_%s" % mapping["param"] |
565 | 565 |
566 def ResolveObject(json, mapping): | 566 def ResolveObject(json, mapping): |
567 mapping["Type"] = "Dictionary" | 567 mapping["Type"] = "Dictionary" |
568 mapping["storage_type"] = "scoped_ptr<base::DictionaryValue>" | 568 mapping["storage_type"] = "scoped_ptr<base::DictionaryValue>" |
569 mapping["raw_type"] = "base::DictionaryValue*" | 569 mapping["raw_type"] = "base::DictionaryValue*" |
570 mapping["pass_template"] = tmpl_object_pass | 570 mapping["pass_template"] = tmpl_object_pass |
| 571 mapping["init"] = " = nullptr" |
571 if "properties" in json: | 572 if "properties" in json: |
572 if not "declared_name" in mapping: | 573 if not "declared_name" in mapping: |
573 mapping["declared_name"] = ("%s%s" % | 574 mapping["declared_name"] = ("%s%s" % |
574 (mapping["Command"], Capitalize(mapping["proto_param"]))) | 575 (mapping["Command"], Capitalize(mapping["proto_param"]))) |
575 mapping["param_type"] = ("scoped_refptr<%s>" % | 576 mapping["param_type"] = ("scoped_refptr<%s>" % |
576 tmpl_typename.substitute(mapping)) | 577 tmpl_typename.substitute(mapping)) |
577 DeclareStruct(json["properties"], mapping) | 578 DeclareStruct(json["properties"], mapping) |
578 else: | 579 else: |
579 mapping["param_type"] = ("scoped_refptr<%s>" % | 580 mapping["param_type"] = ("scoped_refptr<%s>" % |
580 tmpl_typename.substitute(mapping)) | 581 tmpl_typename.substitute(mapping)) |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 output_h_file.close() | 797 output_h_file.close() |
797 | 798 |
798 output_cc_file.write(template_cc.substitute({}, | 799 output_cc_file.write(template_cc.substitute({}, |
799 major = blink_protocol["version"]["major"], | 800 major = blink_protocol["version"]["major"], |
800 minor = blink_protocol["version"]["minor"], | 801 minor = blink_protocol["version"]["minor"], |
801 includes = "".join(sorted(includes)), | 802 includes = "".join(sorted(includes)), |
802 fields_init = ",\n ".join(fields_init), | 803 fields_init = ",\n ".join(fields_init), |
803 methods = "\n".join(handler_method_impls), | 804 methods = "\n".join(handler_method_impls), |
804 types = "\n".join(type_impls))) | 805 types = "\n".join(type_impls))) |
805 output_cc_file.close() | 806 output_cc_file.close() |
OLD | NEW |