| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return new ${declared_name}Builder<kNoneSet>(); | 125 return new ${declared_name}Builder<kNoneSet>(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 scoped_ptr<base::DictionaryValue> ToValue() { | 128 scoped_ptr<base::DictionaryValue> ToValue() { |
| 129 static_assert(MASK == kAllSet, "required properties missing"); | 129 static_assert(MASK == kAllSet, "required properties missing"); |
| 130 return make_scoped_ptr(dict_->DeepCopy()); | 130 return make_scoped_ptr(dict_->DeepCopy()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 friend struct ${declared_name}Builder<0>; | 134 friend struct ${declared_name}Builder<0>; |
| 135 friend class base::RefCounted<${declared_name}Builder<MASK>>; |
| 136 virtual ~${declared_name}Builder() {} |
| 135 | 137 |
| 136 ${declared_name}Builder() : dict_(new base::DictionaryValue()) { | 138 ${declared_name}Builder() : dict_(new base::DictionaryValue()) { |
| 137 } | 139 } |
| 138 | 140 |
| 139 template<class T> T* ThisAs() { | 141 template<class T> T* ThisAs() { |
| 140 static_assert(sizeof(*this) == sizeof(T), "cannot cast"); | 142 static_assert(sizeof(*this) == sizeof(T), "cannot cast"); |
| 141 return reinterpret_cast<T*>(this); | 143 return reinterpret_cast<T*>(this); |
| 142 } | 144 } |
| 143 | 145 |
| 144 scoped_ptr<base::DictionaryValue> dict_; | 146 scoped_ptr<base::DictionaryValue> dict_; |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 output_h_file.close() | 794 output_h_file.close() |
| 793 | 795 |
| 794 output_cc_file.write(template_cc.substitute({}, | 796 output_cc_file.write(template_cc.substitute({}, |
| 795 major = blink_protocol["version"]["major"], | 797 major = blink_protocol["version"]["major"], |
| 796 minor = blink_protocol["version"]["minor"], | 798 minor = blink_protocol["version"]["minor"], |
| 797 includes = "".join(sorted(includes)), | 799 includes = "".join(sorted(includes)), |
| 798 fields_init = ",\n ".join(fields_init), | 800 fields_init = ",\n ".join(fields_init), |
| 799 methods = "\n".join(handler_method_impls), | 801 methods = "\n".join(handler_method_impls), |
| 800 types = "\n".join(type_impls))) | 802 types = "\n".join(type_impls))) |
| 801 output_cc_file.close() | 803 output_cc_file.close() |
| OLD | NEW |