OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 Google Inc. All rights reserved. | 2 # Copyright (c) 2013 Google Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 import string | 32 import string |
33 import sys | 33 import sys |
34 | 34 |
35 template_h = string.Template("""// Code generated from InspectorInstrumentation.
idl | 35 template_h = string.Template("""// Code generated from InspectorInstrumentation.
idl |
36 | 36 |
37 #ifndef ${file_name}_h | 37 #ifndef ${file_name}_h |
38 #define ${file_name}_h | 38 #define ${file_name}_h |
39 | 39 |
40 ${includes} | 40 ${includes} |
41 | 41 |
42 namespace WebCore { | 42 namespace blink { |
43 | 43 |
44 namespace InspectorInstrumentation { | 44 namespace InspectorInstrumentation { |
45 | 45 |
46 $methods | 46 $methods |
47 } // namespace InspectorInstrumentation | 47 } // namespace InspectorInstrumentation |
48 | 48 |
49 } // namespace WebCore | 49 } // namespace blink |
50 | 50 |
51 #endif // !defined(${file_name}_h) | 51 #endif // !defined(${file_name}_h) |
52 """) | 52 """) |
53 | 53 |
54 template_inline = string.Template(""" | 54 template_inline = string.Template(""" |
55 inline void ${name}(${params_public}) | 55 inline void ${name}(${params_public}) |
56 { ${fast_return} | 56 { ${fast_return} |
57 if (${condition}) | 57 if (${condition}) |
58 ${name}Impl(${params_impl}); | 58 ${name}Impl(${params_impl}); |
59 } | 59 } |
(...skipping 15 matching lines...) Expand all Loading... |
75 } | 75 } |
76 """) | 76 """) |
77 | 77 |
78 | 78 |
79 template_cpp = string.Template("""// Code generated from InspectorInstrumentatio
n.idl | 79 template_cpp = string.Template("""// Code generated from InspectorInstrumentatio
n.idl |
80 | 80 |
81 #include "config.h" | 81 #include "config.h" |
82 | 82 |
83 ${includes} | 83 ${includes} |
84 | 84 |
85 namespace WebCore { | 85 namespace blink { |
86 ${extra_definitions} | 86 ${extra_definitions} |
87 | 87 |
88 namespace InspectorInstrumentation { | 88 namespace InspectorInstrumentation { |
89 $methods | 89 $methods |
90 | 90 |
91 } // namespace InspectorInstrumentation | 91 } // namespace InspectorInstrumentation |
92 | 92 |
93 } // namespace WebCore | 93 } // namespace blink |
94 """) | 94 """) |
95 | 95 |
96 template_outofline = string.Template(""" | 96 template_outofline = string.Template(""" |
97 ${return_type} ${name}Impl(${params_impl}) | 97 ${return_type} ${name}Impl(${params_impl}) |
98 {${impl_lines} | 98 {${impl_lines} |
99 }""") | 99 }""") |
100 | 100 |
101 template_agent_call = string.Template(""" | 101 template_agent_call = string.Template(""" |
102 if (${agent_class}* agent = ${agent_fetch}) | 102 if (${agent_class}* agent = ${agent_fetch}) |
103 ${maybe_return}agent->${name}(${params_agent});""") | 103 ${maybe_return}agent->${name}(${params_agent});""") |
(...skipping 10 matching lines...) Expand all Loading... |
114 | 114 |
115 #ifndef InstrumentingAgentsInl_h | 115 #ifndef InstrumentingAgentsInl_h |
116 #define InstrumentingAgentsInl_h | 116 #define InstrumentingAgentsInl_h |
117 | 117 |
118 #include "platform/heap/Handle.h" | 118 #include "platform/heap/Handle.h" |
119 #include "wtf/FastAllocBase.h" | 119 #include "wtf/FastAllocBase.h" |
120 #include "wtf/Noncopyable.h" | 120 #include "wtf/Noncopyable.h" |
121 #include "wtf/PassRefPtr.h" | 121 #include "wtf/PassRefPtr.h" |
122 #include "wtf/RefCounted.h" | 122 #include "wtf/RefCounted.h" |
123 | 123 |
124 namespace WebCore { | 124 namespace blink { |
125 | 125 |
126 ${forward_list} | 126 ${forward_list} |
127 | 127 |
128 class InstrumentingAgents : public RefCountedWillBeGarbageCollectedFinalized<Ins
trumentingAgents> { | 128 class InstrumentingAgents : public RefCountedWillBeGarbageCollectedFinalized<Ins
trumentingAgents> { |
129 WTF_MAKE_NONCOPYABLE(InstrumentingAgents); | 129 WTF_MAKE_NONCOPYABLE(InstrumentingAgents); |
130 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; | 130 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
131 public: | 131 public: |
132 static PassRefPtrWillBeRawPtr<InstrumentingAgents> create() | 132 static PassRefPtrWillBeRawPtr<InstrumentingAgents> create() |
133 { | 133 { |
134 return adoptRefWillBeNoop(new InstrumentingAgents()); | 134 return adoptRefWillBeNoop(new InstrumentingAgents()); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 if not output_dirpath: | 535 if not output_dirpath: |
536 raise Exception("Output directory must be specified") | 536 raise Exception("Output directory must be specified") |
537 except Exception: | 537 except Exception: |
538 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html | 538 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html |
539 exc = sys.exc_info()[1] | 539 exc = sys.exc_info()[1] |
540 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) | 540 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) |
541 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") | 541 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") |
542 exit(1) | 542 exit(1) |
543 | 543 |
544 generate(input_path, output_dirpath) | 544 generate(input_path, output_dirpath) |
OLD | NEW |