Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/core/inspector/CodeGeneratorInspector.py

Issue 813473003: replace COMPILE_ASSERT with static_assert in core/inspector/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/inspector/CodeGeneratorInspectorStrings.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 Google Inc. All rights reserved. 2 # Copyright (c) 2011 Google Inc. All rights reserved.
3 # Copyright (c) 2012 Intel Corporation. All rights reserved. 3 # Copyright (c) 2012 Intel Corporation. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 Capitalizer.lower_camel_case_to_upper (prop_name), 999 Capitalizer.lower_camel_case_to_upper (prop_name),
1000 param_type_binding.get_type_model().g et_input_param_type_text(), 1000 param_type_binding.get_type_model().g et_input_param_type_text(),
1001 state_enum_items[pos], prop_name, 1001 state_enum_items[pos], prop_name,
1002 param_raw_type.get_setter_name(), pro p_name, 1002 param_raw_type.get_setter_name(), pro p_name,
1003 format_setter_value_expression(param_ type_binding, "value"), 1003 format_setter_value_expression(param_ type_binding, "value"),
1004 state_enum_items[pos])) 1004 state_enum_items[pos]))
1005 1005
1006 pos += 1 1006 pos += 1
1007 1007
1008 writer.newline_multiline(CodeGeneratorInspectorS trings.class_binding_builder_part_3 1008 writer.newline_multiline(CodeGeneratorInspectorS trings.class_binding_builder_part_3
1009 % (class_name, class_na me, class_name, class_name, class_name)) 1009 % (class_name, class_na me, class_name, class_name, class_name, class_name))
1010 1010
1011 writer.newline(" /*\n") 1011 writer.newline(" /*\n")
1012 writer.newline(" * Synthetic constructor:\n" ) 1012 writer.newline(" * Synthetic constructor:\n" )
1013 writer.newline(" * RefPtr<%s> result = %s::c reate()" % (class_name, class_name)) 1013 writer.newline(" * RefPtr<%s> result = %s::c reate()" % (class_name, class_name))
1014 for prop_data in resolve_data.main_properties: 1014 for prop_data in resolve_data.main_properties:
1015 writer.append_multiline("\n * .set%s (...)" % Capitalizer.lower_camel_case_to_upper(prop_data.p["name"])) 1015 writer.append_multiline("\n * .set%s (...)" % Capitalizer.lower_camel_case_to_upper(prop_data.p["name"]))
1016 writer.append_multiline(";\n */\n") 1016 writer.append_multiline(";\n */\n")
1017 1017
1018 writer.newline_multiline(CodeGeneratorInspectorS trings.class_binding_builder_part_4) 1018 writer.newline_multiline(CodeGeneratorInspectorS trings.class_binding_builder_part_4)
1019 1019
(...skipping 28 matching lines...) Expand all
1048 1048
1049 if class_binding_cls.need_user_runtime_cast_: 1049 if class_binding_cls.need_user_runtime_cast_:
1050 writer.newline(" static PassRefPtr<%s> ru ntimeCast(PassRefPtr<JSONValue> value)\n" % class_name) 1050 writer.newline(" static PassRefPtr<%s> ru ntimeCast(PassRefPtr<JSONValue> value)\n" % class_name)
1051 writer.newline(" {\n") 1051 writer.newline(" {\n")
1052 writer.newline(" RefPtr<JSONObject> o bject;\n") 1052 writer.newline(" RefPtr<JSONObject> o bject;\n")
1053 writer.newline(" bool castRes = value ->asObject(&object);\n") 1053 writer.newline(" bool castRes = value ->asObject(&object);\n")
1054 writer.newline(" ASSERT_UNUSED(castRe s, castRes);\n") 1054 writer.newline(" ASSERT_UNUSED(castRe s, castRes);\n")
1055 writer.append("#if %s\n" % VALIDATOR_IFDEF_N AME) 1055 writer.append("#if %s\n" % VALIDATOR_IFDEF_N AME)
1056 writer.newline(" assertCorrectValue(o bject.get());\n") 1056 writer.newline(" assertCorrectValue(o bject.get());\n")
1057 writer.append("#endif // %s\n" % VALIDATOR_ IFDEF_NAME) 1057 writer.append("#endif // %s\n" % VALIDATOR_ IFDEF_NAME)
1058 writer.newline(" COMPILE_ASSERT(sizeo f(%s) == sizeof(JSONObjectBase), type_cast_problem);\n" % class_name) 1058 writer.newline(" static_assert(sizeof (%s) == sizeof(JSONObjectBase), \"%s should be the same size as JSONObjectBase\" );\n" % (class_name, class_name))
1059 writer.newline(" return static_cast<% s*>(static_cast<JSONObjectBase*>(object.get()));\n" % class_name) 1059 writer.newline(" return static_cast<% s*>(static_cast<JSONObjectBase*>(object.get()));\n" % class_name)
1060 writer.newline(" }\n") 1060 writer.newline(" }\n")
1061 writer.append("\n") 1061 writer.append("\n")
1062 1062
1063 if class_binding_cls.need_internal_runtime_cast_ : 1063 if class_binding_cls.need_internal_runtime_cast_ :
1064 writer.append("#if %s\n" % VALIDATOR_IFDEF_N AME) 1064 writer.append("#if %s\n" % VALIDATOR_IFDEF_N AME)
1065 writer.newline(" static void assertCorrec tValue(JSONValue* value);\n") 1065 writer.newline(" static void assertCorrec tValue(JSONValue* value);\n")
1066 writer.append("#endif // %s\n" % VALIDATOR_ IFDEF_NAME) 1066 writer.append("#endif // %s\n" % VALIDATOR_ IFDEF_NAME)
1067 1067
1068 closed_field_set = (context_domain_name + ". " + class_name) not in TYPES_WITH_OPEN_FIELD_LIST_SET 1068 closed_field_set = (context_domain_name + ". " + class_name) not in TYPES_WITH_OPEN_FIELD_LIST_SET
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 validatorIfdefName=VALIDATOR_IFDEF_NAME)) 2118 validatorIfdefName=VALIDATOR_IFDEF_NAME))
2119 2119
2120 backend_h_file.close() 2120 backend_h_file.close()
2121 backend_cpp_file.close() 2121 backend_cpp_file.close()
2122 2122
2123 frontend_h_file.close() 2123 frontend_h_file.close()
2124 frontend_cpp_file.close() 2124 frontend_cpp_file.close()
2125 2125
2126 typebuilder_h_file.close() 2126 typebuilder_h_file.close()
2127 typebuilder_cpp_file.close() 2127 typebuilder_cpp_file.close()
OLDNEW
« no previous file with comments | « no previous file | Source/core/inspector/CodeGeneratorInspectorStrings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698