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

Side by Side Diff: tools/dom/scripts/generator.py

Issue 1414903007: Serialize the data argument to History's state-related APIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add a TODO Created 5 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
« no previous file with comments | « tests/html/history_test.dart ('k') | 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 systems to generate 6 """This module provides shared functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import copy 9 import copy
10 import json 10 import json
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 725
726 '* get CustomEvent.detail': 726 '* get CustomEvent.detail':
727 Conversion('convertNativeToDart_SerializedScriptValue', 727 Conversion('convertNativeToDart_SerializedScriptValue',
728 'dynamic', 'dynamic'), 728 'dynamic', 'dynamic'),
729 729
730 # receiving message via MessageEvent 730 # receiving message via MessageEvent
731 '* get MessageEvent.data': 731 '* get MessageEvent.data':
732 Conversion('convertNativeToDart_SerializedScriptValue', 732 Conversion('convertNativeToDart_SerializedScriptValue',
733 'dynamic', 'dynamic'), 733 'dynamic', 'dynamic'),
734 734
735 # TODO(alanknight): This generates two variations for dart2js, because of
736 # the optional argument, but not in Dartium. Should do the same for both.
737 'any set History.pushState': _serialize_SSV,
738
739 'any set History.replaceState': _serialize_SSV,
740
735 '* get History.state': 741 '* get History.state':
736 Conversion('convertNativeToDart_SerializedScriptValue', 742 Conversion('convertNativeToDart_SerializedScriptValue',
737 'dynamic', 'dynamic'), 743 'dynamic', 'dynamic'),
738 744
739 '* get PopStateEvent.state': 745 '* get PopStateEvent.state':
740 Conversion('convertNativeToDart_SerializedScriptValue', 746 Conversion('convertNativeToDart_SerializedScriptValue',
741 'dynamic', 'dynamic'), 747 'dynamic', 'dynamic'),
742 748
743 # IDBAny is problematic. Some uses are just a union of other IDB types, 749 # IDBAny is problematic. Some uses are just a union of other IDB types,
744 # which need no conversion.. Others include data values which require 750 # which need no conversion.. Others include data values which require
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 """Return True if the type is a List<Node>""" 1442 """Return True if the type is a List<Node>"""
1437 return return_type.startswith('List<Node>') 1443 return return_type.startswith('List<Node>')
1438 1444
1439 def wrap_unwrap_type_blink(return_type, type_registry): 1445 def wrap_unwrap_type_blink(return_type, type_registry):
1440 """Returns True if the type is a blink type that requires wrap_jso or 1446 """Returns True if the type is a blink type that requires wrap_jso or
1441 unwrap_jso""" 1447 unwrap_jso"""
1442 if return_type and return_type.startswith('Html'): 1448 if return_type and return_type.startswith('Html'):
1443 return_type = return_type.replace('Html', 'HTML', 1) 1449 return_type = return_type.replace('Html', 'HTML', 1)
1444 return (type_registry.HasInterface(return_type) or not(return_type) or 1450 return (type_registry.HasInterface(return_type) or not(return_type) or
1445 return_type == 'Object' or 1451 return_type == 'Object' or
1452 return_type == 'dynamic' or
1446 return_type == 'Future' or 1453 return_type == 'Future' or
1447 return_type == 'SqlDatabase' or # renamed to Database 1454 return_type == 'SqlDatabase' or # renamed to Database
1448 return_type == 'HTMLElement' or 1455 return_type == 'HTMLElement' or
1449 return_type == 'MutationObserver' or 1456 return_type == 'MutationObserver' or
1450 (return_type.endswith('[]') and return_type != 'DOMString[]')) 1457 (return_type.endswith('[]') and return_type != 'DOMString[]'))
1451 1458
1452 def wrap_type_blink(return_type, type_registry): 1459 def wrap_type_blink(return_type, type_registry):
1453 """Returns True if the type is a blink type that requires wrap_jso but 1460 """Returns True if the type is a blink type that requires wrap_jso but
1454 NOT unwrap_jso""" 1461 NOT unwrap_jso"""
1455 return (return_type == 'Map' or 1462 return (return_type == 'Map' or
1456 return_type == 'Rectangle') 1463 return_type == 'Rectangle')
1457 1464
1458 def wrap_return_type_blink(return_type, type_name, type_registry): 1465 def wrap_return_type_blink(return_type, type_name, type_registry):
1459 """Returns True if we should wrap the returned value. This checks 1466 """Returns True if we should wrap the returned value. This checks
1460 a number of different variations, calling the more basic functions 1467 a number of different variations, calling the more basic functions
1461 above.""" 1468 above."""
1462 return (wrap_unwrap_type_blink(return_type, type_registry) or 1469 return (wrap_unwrap_type_blink(return_type, type_registry) or
1463 wrap_unwrap_type_blink(type_name, type_registry) or 1470 wrap_unwrap_type_blink(type_name, type_registry) or
1464 wrap_type_blink(return_type, type_registry) or 1471 wrap_type_blink(return_type, type_registry) or
1465 wrap_unwrap_list_blink(return_type, type_registry)) 1472 wrap_unwrap_list_blink(return_type, type_registry))
OLDNEW
« no previous file with comments | « tests/html/history_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698