OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """ Generator for C++ style thunks """ | 6 """ Generator for C++ style thunks """ |
7 | 7 |
8 import glob | 8 import glob |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 def _MakeEnterLine(filenode, interface, arg, handle_errors, callback, meta): | 86 def _MakeEnterLine(filenode, interface, arg, handle_errors, callback, meta): |
87 """Returns an EnterInstance/EnterResource string for a function.""" | 87 """Returns an EnterInstance/EnterResource string for a function.""" |
88 if arg[0] == 'PP_Instance': | 88 if arg[0] == 'PP_Instance': |
89 if callback is None: | 89 if callback is None: |
90 return 'EnterInstance enter(%s);' % arg[1] | 90 return 'EnterInstance enter(%s);' % arg[1] |
91 else: | 91 else: |
92 return 'EnterInstance enter(%s, %s);' % (arg[1], callback) | 92 return 'EnterInstance enter(%s, %s);' % (arg[1], callback) |
93 elif arg[0] == 'PP_Resource': | 93 elif arg[0] == 'PP_Resource': |
94 api_name = interface.GetName() | 94 api_name = interface.GetName() |
| 95 if api_name.endswith('Trusted'): |
| 96 api_name = api_name[:-len('Trusted')] |
95 if api_name.endswith('_Dev'): | 97 if api_name.endswith('_Dev'): |
96 api_name = api_name[:-len('_Dev')] | 98 api_name = api_name[:-len('_Dev')] |
97 api_name += '_API' | 99 api_name += '_API' |
98 | 100 |
99 enter_type = 'EnterResource<%s>' % api_name | 101 enter_type = 'EnterResource<%s>' % api_name |
100 # The API header matches the file name, not the interface name. | 102 # The API header matches the file name, not the interface name. |
101 api_basename = _GetBaseFileName(filenode) | 103 api_basename = _GetBaseFileName(filenode) |
102 if api_basename.endswith('_dev'): | 104 if api_basename.endswith('_dev'): |
103 # Clip off _dev suffix. | 105 # Clip off _dev suffix. |
104 api_basename = api_basename[:-len('_dev')] | 106 api_basename = api_basename[:-len('_dev')] |
| 107 if api_basename.endswith('_trusted'): |
| 108 # Clip off _trusted suffix. |
| 109 api_basename = api_basename[:-len('_trusted')] |
105 meta.AddApi(api_basename + '_api') | 110 meta.AddApi(api_basename + '_api') |
106 | 111 |
107 if callback is None: | 112 if callback is None: |
108 return '%s enter(%s, %s);' % (enter_type, arg[1], | 113 return '%s enter(%s, %s);' % (enter_type, arg[1], |
109 str(handle_errors).lower()) | 114 str(handle_errors).lower()) |
110 else: | 115 else: |
111 return '%s enter(%s, %s, %s);' % (enter_type, arg[1], | 116 return '%s enter(%s, %s, %s);' % (enter_type, arg[1], |
112 callback, | 117 callback, |
113 str(handle_errors).lower()) | 118 str(handle_errors).lower()) |
114 else: | 119 else: |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 print "Golden file for M13-M14 failed." | 483 print "Golden file for M13-M14 failed." |
479 failed = 1 | 484 failed = 1 |
480 else: | 485 else: |
481 print "Golden file for M13-M14 passed." | 486 print "Golden file for M13-M14 passed." |
482 | 487 |
483 return failed | 488 return failed |
484 | 489 |
485 | 490 |
486 if __name__ == '__main__': | 491 if __name__ == '__main__': |
487 sys.exit(Main(sys.argv[1:])) | 492 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |