| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 { ${fast_return} | 73 { ${fast_return} |
| 74 if (${condition}) | 74 if (${condition}) |
| 75 return ${name}Impl(${params_impl}); | 75 return ${name}Impl(${params_impl}); |
| 76 return ${default_return_value}; | 76 return ${default_return_value}; |
| 77 } | 77 } |
| 78 """) | 78 """) |
| 79 | 79 |
| 80 | 80 |
| 81 template_cpp = string.Template("""// Code generated from InspectorInstrumentatio
n.idl | 81 template_cpp = string.Template("""// Code generated from InspectorInstrumentatio
n.idl |
| 82 | 82 |
| 83 #include "config.h" | |
| 84 | |
| 85 ${includes} | 83 ${includes} |
| 86 | 84 |
| 87 namespace blink { | 85 namespace blink { |
| 88 ${extra_definitions} | 86 ${extra_definitions} |
| 89 | 87 |
| 90 namespace InspectorInstrumentation { | 88 namespace InspectorInstrumentation { |
| 91 $methods | 89 $methods |
| 92 | 90 |
| 93 } // namespace InspectorInstrumentation | 91 } // namespace InspectorInstrumentation |
| 94 | 92 |
| 95 } // namespace blink | 93 } // namespace blink |
| 96 """) | 94 """) |
| 97 | 95 |
| 98 template_outofline = string.Template(""" | 96 template_outofline = string.Template(""" |
| 99 ${return_type} ${name}Impl(${params_impl}) | 97 ${return_type} ${name}Impl(${params_impl}) |
| 100 {${impl_lines} | 98 {${impl_lines} |
| 101 }""") | 99 }""") |
| 102 | 100 |
| 103 template_agent_call = string.Template(""" | 101 template_agent_call = string.Template(""" |
| 104 if (${agent_class}* agent = ${agent_fetch}) | 102 if (${agent_class}* agent = ${agent_fetch}) |
| 105 ${maybe_return}agent->${name}(${params_agent});""") | 103 ${maybe_return}agent->${name}(${params_agent});""") |
| 106 | 104 |
| 107 template_instrumenting_agents_h = string.Template("""// Code generated from Insp
ectorInstrumentation.idl | 105 template_instrumenting_agents_h = string.Template("""// Code generated from Insp
ectorInstrumentation.idl |
| 108 | 106 |
| 109 #ifndef InstrumentingAgentsInl_h | 107 #ifndef InstrumentingAgentsInl_h |
| 110 #define InstrumentingAgentsInl_h | 108 #define InstrumentingAgentsInl_h |
| 111 | 109 |
| 112 #include "core/CoreExport.h" | 110 #include "core/CoreExport.h" |
| 113 #include "platform/heap/Handle.h" | 111 #include "platform/heap/Handle.h" |
| 114 #include "wtf/FastAllocBase.h" | 112 #include "wtf/Allocator.h" |
| 115 #include "wtf/Noncopyable.h" | 113 #include "wtf/Noncopyable.h" |
| 116 #include "wtf/PassRefPtr.h" | 114 #include "wtf/PassRefPtr.h" |
| 117 #include "wtf/RefCounted.h" | 115 #include "wtf/RefCounted.h" |
| 118 | 116 |
| 119 namespace blink { | 117 namespace blink { |
| 120 | 118 |
| 121 ${forward_list} | 119 ${forward_list} |
| 122 | 120 |
| 123 class CORE_EXPORT InstrumentingAgents : public RefCountedWillBeGarbageCollectedF
inalized<InstrumentingAgents> { | 121 class CORE_EXPORT InstrumentingAgents : public RefCountedWillBeGarbageCollectedF
inalized<InstrumentingAgents> { |
| 124 WTF_MAKE_NONCOPYABLE(InstrumentingAgents); | 122 WTF_MAKE_NONCOPYABLE(InstrumentingAgents); |
| 125 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InstrumentingAgents); | 123 USING_FAST_MALLOC_WILL_BE_REMOVED(InstrumentingAgents); |
| 126 public: | 124 public: |
| 127 static PassRefPtrWillBeRawPtr<InstrumentingAgents> create() | 125 static PassRefPtrWillBeRawPtr<InstrumentingAgents> create() |
| 128 { | 126 { |
| 129 return adoptRefWillBeNoop(new InstrumentingAgents()); | 127 return adoptRefWillBeNoop(new InstrumentingAgents()); |
| 130 } | 128 } |
| 131 ~InstrumentingAgents() { } | 129 ~InstrumentingAgents() { } |
| 132 DECLARE_TRACE(); | 130 DECLARE_TRACE(); |
| 133 void reset(); | 131 void reset(); |
| 134 | 132 |
| 135 ${accessor_list} | 133 ${accessor_list} |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if not output_dirpath: | 539 if not output_dirpath: |
| 542 raise Exception("Output directory must be specified") | 540 raise Exception("Output directory must be specified") |
| 543 except Exception: | 541 except Exception: |
| 544 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html | 542 # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html |
| 545 exc = sys.exc_info()[1] | 543 exc = sys.exc_info()[1] |
| 546 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) | 544 sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) |
| 547 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") | 545 sys.stderr.write("Usage: <script> --output_dir <output_dir> InspectorInstrum
entation.idl\n") |
| 548 exit(1) | 546 exit(1) |
| 549 | 547 |
| 550 generate(input_path, output_dirpath) | 548 generate(input_path, output_dirpath) |
| OLD | NEW |