OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/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 package = sys.argv[1] | 10 package = sys.argv[1] |
11 output_cc_path = sys.argv[2] | 11 output_cc_path = sys.argv[2] |
12 output_h_path = sys.argv[3] | 12 output_h_path = sys.argv[3] |
13 blink_protocol_path = sys.argv[4] | 13 blink_protocol_path = sys.argv[4] |
14 browser_protocol_path = sys.argv[5] if len(sys.argv) > 5 else None | 14 browser_protocol_path = sys.argv[5] if len(sys.argv) > 5 else None |
15 | 15 |
16 template_h = string.Template("""\ | 16 template_h = string.Template("""\ |
17 // Copyright 2013 The Chromium Authors. All rights reserved. | 17 // Copyright 2013 The Chromium Authors. All rights reserved. |
18 // Use of this source code is governed by a BSD-style license that can be | 18 // Use of this source code is governed by a BSD-style license that can be |
19 // found in the LICENSE file. | 19 // found in the LICENSE file. |
20 | 20 |
21 #ifndef ${PACKAGE}_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_CONSTANTS_H_ | 21 #ifndef ${PACKAGE}_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_CONSTANTS_H_ |
22 #define ${PACKAGE}_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_CONSTANTS_H_ | 22 #define ${PACKAGE}_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_CONSTANTS_H_ |
23 | 23 |
24 // THIS FILE IS AUTOGENERATED. DO NOT EDIT. | 24 // THIS FILE IS AUTOGENERATED. DO NOT EDIT. |
25 // Generated by | 25 // Generated by |
26 // chrome/browser/devtools/devtools_protocol_constants_generator.py from | 26 // chrome/browser/devtools/devtools_protocol_constants_generator.py from |
27 // third_party/WebKit/Source/devtools/protocol.json and | 27 // gen/blink/core/inspector/protocol.json and |
28 // content/browser/devtools/browser_protocol.json | 28 // content/browser/devtools/browser_protocol.json |
29 | 29 |
30 #include <string> | 30 #include <string> |
31 | 31 |
32 namespace $package { | 32 namespace $package { |
33 namespace devtools { | 33 namespace devtools { |
34 | 34 |
35 extern const char kProtocolVersion[]; | 35 extern const char kProtocolVersion[]; |
36 | 36 |
37 bool IsSupportedProtocolVersion(const std::string& version); | 37 bool IsSupportedProtocolVersion(const std::string& version); |
38 | 38 |
39 extern const char kResult[]; | 39 extern const char kResult[]; |
40 $contents | 40 $contents |
41 | 41 |
42 } // devtools | 42 } // devtools |
43 } // $package | 43 } // $package |
44 | 44 |
45 #endif // ${PACKAGE}_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_CONSTANTS_H_ | 45 #endif // ${PACKAGE}_BROWSER_DEVTOOLS_DEVTOOLS_PROTOCOL_CONSTANTS_H_ |
46 """) | 46 """) |
47 | 47 |
48 template_cc = string.Template("""\ | 48 template_cc = string.Template("""\ |
49 // Copyright 2013 The Chromium Authors. All rights reserved. | 49 // Copyright 2013 The Chromium Authors. All rights reserved. |
50 // Use of this source code is governed by a BSD-style license that can be | 50 // Use of this source code is governed by a BSD-style license that can be |
51 // found in the LICENSE file. | 51 // found in the LICENSE file. |
52 | 52 |
53 // THIS FILE IS AUTOGENERATED. DO NOT EDIT. | 53 // THIS FILE IS AUTOGENERATED. DO NOT EDIT. |
54 // Generated by | 54 // Generated by |
55 // chrome/browser/devtools/devtools_protocol_constants_generator.py from | 55 // chrome/browser/devtools/devtools_protocol_constants_generator.py from |
56 // third_party/WebKit/Source/devtools/protocol.json and | 56 // gen/blink/core/inspector/protocol.json and |
57 // content/browser/devtools/browser_protocol.json | 57 // content/browser/devtools/browser_protocol.json |
58 | 58 |
59 #include "base/strings/string_number_conversions.h" | 59 #include "base/strings/string_number_conversions.h" |
60 #include "base/strings/string_split.h" | 60 #include "base/strings/string_split.h" |
61 #include "base/strings/string_util.h" | 61 #include "base/strings/string_util.h" |
62 #include "$package/browser/devtools/devtools_protocol_constants.h" | 62 #include "$package/browser/devtools/devtools_protocol_constants.h" |
63 | 63 |
64 namespace $package { | 64 namespace $package { |
65 namespace devtools { | 65 namespace devtools { |
66 | 66 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 sys.exit(1) | 203 sys.exit(1) |
204 | 204 |
205 for (namespace_name, namespace) in namespace_tree.items(): | 205 for (namespace_name, namespace) in namespace_tree.items(): |
206 namespace["kName"] = namespace_name | 206 namespace["kName"] = namespace_name |
207 | 207 |
208 with open(output_cc_path, "w") as f: | 208 with open(output_cc_path, "w") as f: |
209 CreateBody(namespace_tree, blink_version, f) | 209 CreateBody(namespace_tree, blink_version, f) |
210 | 210 |
211 with open(output_h_path, "w") as f: | 211 with open(output_h_path, "w") as f: |
212 CreateHeader(namespace_tree, f) | 212 CreateHeader(namespace_tree, f) |
OLD | NEW |