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

Side by Side Diff: lib/html/scripts/systemnative.py

Issue 11358009: Migrate dart:html codegenerator to new embedder's API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext')) 595 v8EnabledPerContext = ext_attrs.get('synthesizedV8EnabledPerContext', ext_at trs.get('V8EnabledPerContext'))
596 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime')) 596 v8EnabledAtRuntime = ext_attrs.get('synthesizedV8EnabledAtRuntime', ext_attr s.get('V8EnabledAtRuntime'))
597 assert(not (v8EnabledPerContext and v8EnabledAtRuntime)) 597 assert(not (v8EnabledPerContext and v8EnabledAtRuntime))
598 598
599 if v8EnabledPerContext: 599 if v8EnabledPerContext:
600 raises_exceptions = True 600 raises_exceptions = True
601 self._cpp_impl_includes.add('"ContextFeatures.h"') 601 self._cpp_impl_includes.add('"ContextFeatures.h"')
602 self._cpp_impl_includes.add('"DOMWindow.h"') 602 self._cpp_impl_includes.add('"DOMWindow.h"')
603 runtime_check = emitter.Format( 603 runtime_check = emitter.Format(
604 ' if (!ContextFeatures::$(FEATURE)Enabled(DartUtilities::domWin dowForCurrentIsolate()->document())) {\n' 604 ' if (!ContextFeatures::$(FEATURE)Enabled(DartUtilities::domWin dowForCurrentIsolate()->document())) {\n'
605 ' exception = Dart_NewString("Feature $FEATURE is not enabl ed");\n' 605 ' exception = Dart_NewStringFromCString("Feature $FEATURE i s not enabled");\n'
606 ' goto fail;\n' 606 ' goto fail;\n'
607 ' }', 607 ' }',
608 FEATURE=v8EnabledPerContext) 608 FEATURE=v8EnabledPerContext)
609 609
610 if v8EnabledAtRuntime: 610 if v8EnabledAtRuntime:
611 raises_exceptions = True 611 raises_exceptions = True
612 self._cpp_impl_includes.add('"RuntimeEnabledFeatures.h"') 612 self._cpp_impl_includes.add('"RuntimeEnabledFeatures.h"')
613 runtime_check = emitter.Format( 613 runtime_check = emitter.Format(
614 ' if (!RuntimeEnabledFeatures::$(FEATURE)Enabled()) {\n' 614 ' if (!RuntimeEnabledFeatures::$(FEATURE)Enabled()) {\n'
615 ' exception = Dart_NewString("Feature $FEATURE is not enabl ed");\n' 615 ' exception = Dart_NewStringFromCString("Feature $FEATURE i s not enabled");\n'
616 ' goto fail;\n' 616 ' goto fail;\n'
617 ' }', 617 ' }',
618 FEATURE=self._ToWebKitName(v8EnabledAtRuntime)) 618 FEATURE=self._ToWebKitName(v8EnabledAtRuntime))
619 619
620 body_emitter = self._cpp_definitions_emitter.Emit( 620 body_emitter = self._cpp_definitions_emitter.Emit(
621 '\n' 621 '\n'
622 'static void $CALLBACK_NAME(Dart_NativeArguments args)\n' 622 'static void $CALLBACK_NAME(Dart_NativeArguments args)\n'
623 '{\n' 623 '{\n'
624 ' DartApiScope dartApiScope;\n' 624 ' DartApiScope dartApiScope;\n'
625 '$!BODY' 625 '$!BODY'
(...skipping 21 matching lines...) Expand all
647 647
648 if runtime_check: 648 if runtime_check:
649 body_emitter.Emit( 649 body_emitter.Emit(
650 '$RUNTIME_CHECK\n', 650 '$RUNTIME_CHECK\n',
651 RUNTIME_CHECK=runtime_check) 651 RUNTIME_CHECK=runtime_check)
652 652
653 if requires_script_execution_context: 653 if requires_script_execution_context:
654 body_emitter.Emit( 654 body_emitter.Emit(
655 ' ScriptExecutionContext* context = DartUtilities::scriptExecut ionContext();\n' 655 ' ScriptExecutionContext* context = DartUtilities::scriptExecut ionContext();\n'
656 ' if (!context) {\n' 656 ' if (!context) {\n'
657 ' exception = Dart_NewString("Failed to retrieve a context" );\n' 657 ' exception = Dart_NewStringFromCString("Failed to retrieve a context");\n'
658 ' goto fail;\n' 658 ' goto fail;\n'
659 ' }\n\n') 659 ' }\n\n')
660 660
661 if requires_dom_window: 661 if requires_dom_window:
662 self._cpp_impl_includes.add('"DOMWindow.h"') 662 self._cpp_impl_includes.add('"DOMWindow.h"')
663 body_emitter.Emit( 663 body_emitter.Emit(
664 ' DOMWindow* domWindow = DartUtilities::domWindowForCurrentIsol ate();\n' 664 ' DOMWindow* domWindow = DartUtilities::domWindowForCurrentIsol ate();\n'
665 ' if (!domWindow) {\n' 665 ' if (!domWindow) {\n'
666 ' exception = Dart_NewString("Failed to fetch domWindow");\ n' 666 ' exception = Dart_NewStringFromCString("Failed to fetch do mWindow");\n'
667 ' goto fail;\n' 667 ' goto fail;\n'
668 ' }\n' 668 ' }\n'
669 ' Document* document = domWindow->document();\n') 669 ' Document* document = domWindow->document();\n')
670 670
671 if needs_receiver: 671 if needs_receiver:
672 body_emitter.Emit( 672 body_emitter.Emit(
673 ' $WEBCORE_CLASS_NAME* receiver = DartDOMWrapper::receiver< $WE BCORE_CLASS_NAME >(args);\n', 673 ' $WEBCORE_CLASS_NAME* receiver = DartDOMWrapper::receiver< $WE BCORE_CLASS_NAME >(args);\n',
674 WEBCORE_CLASS_NAME=self._interface_type_info.native_type()) 674 WEBCORE_CLASS_NAME=self._interface_type_info.native_type())
675 675
676 if requires_stack_info: 676 if requires_stack_info:
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 def EmitResolver(self, template, output_dir): 858 def EmitResolver(self, template, output_dir):
859 file_path = os.path.join(output_dir, 'DartResolver.cpp') 859 file_path = os.path.join(output_dir, 'DartResolver.cpp')
860 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) 860 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template)
861 for header_file in self._headers_list: 861 for header_file in self._headers_list:
862 path = os.path.relpath(header_file, output_dir) 862 path = os.path.relpath(header_file, output_dir)
863 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 863 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
864 body_emitter.Emit( 864 body_emitter.Emit(
865 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' 865 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n'
866 ' return func;\n', 866 ' return func;\n',
867 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 867 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698