Remove dart:blink dependency on dart:html. This CL moves all of the

overload resolution (dependent on dart specific types) over to the
dart:html side, along with the type resolution maps.  This is a first
step to generating dart:blink from the dartium idl.  There is a paired
blink CL which switches the type map lookup from dart:blink to dart:html.

BUG=
R=jacobr@google.com

Review URL: https://codereview.chromium.org//446193002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38993 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
leafp@google.com 2014-08-07 16:12:50 +00:00
parent d1fe01a657
commit a20d4b09d2
9 changed files with 1022 additions and 1397 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -238,7 +238,18 @@ class Database extends EventTarget {
@DocsEditable()
void deleteObjectStore(String name) => _blink.BlinkIDBDatabase.$deleteObjectStore_Callback(this, name);
Transaction transaction(storeName_OR_storeNames, String mode) => _blink.BlinkIDBDatabase.$transaction(this, storeName_OR_storeNames, mode);
Transaction transaction(storeName_OR_storeNames, String mode) {
if ((mode is String || mode == null) && (storeName_OR_storeNames is DomStringList || storeName_OR_storeNames == null)) {
return _blink.BlinkIDBDatabase.$_transaction_1_Callback(this, storeName_OR_storeNames, mode);
}
if ((mode is String || mode == null) && (storeName_OR_storeNames is List<String> || storeName_OR_storeNames == null)) {
return _blink.BlinkIDBDatabase.$_transaction_2_Callback(this, storeName_OR_storeNames, mode);
}
if ((mode is String || mode == null) && (storeName_OR_storeNames is String || storeName_OR_storeNames == null)) {
return _blink.BlinkIDBDatabase.$_transaction_3_Callback(this, storeName_OR_storeNames, mode);
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('IDBDatabase.transactionList')
@DocsEditable()
@ -372,7 +383,12 @@ class IdbFactory extends NativeFieldWrapperClass2 {
@DocsEditable()
OpenDBRequest _deleteDatabase(String name) => _blink.BlinkIDBFactory.$deleteDatabase_Callback(this, name);
OpenDBRequest _open(String name, [int version]) => _blink.BlinkIDBFactory.$_open(this, name, version);
OpenDBRequest _open(String name, [int version]) {
if (version != null) {
return _blink.BlinkIDBFactory.$_open_1_Callback(this, name, version);
}
return _blink.BlinkIDBFactory.$_open_2_Callback(this, name);
}
@DomName('IDBFactory.webkitGetDatabaseNames')
@DocsEditable()
@ -772,7 +788,15 @@ class ObjectStore extends NativeFieldWrapperClass2 {
@DocsEditable()
Request _count(Object key) => _blink.BlinkIDBObjectStore.$count_Callback(this, key);
Index _createIndex(String name, keyPath, [Map options]) => _blink.BlinkIDBObjectStore.$_createIndex(this, name, keyPath, options);
Index _createIndex(String name, keyPath, [Map options]) {
if ((options is Map || options == null) && (keyPath is List<String> || keyPath == null) && (name is String || name == null)) {
return _blink.BlinkIDBObjectStore.$_createIndex_1_Callback(this, name, keyPath, options);
}
if ((options is Map || options == null) && (keyPath is String || keyPath == null) && (name is String || name == null)) {
return _blink.BlinkIDBObjectStore.$_createIndex_2_Callback(this, name, keyPath, options);
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('IDBObjectStore.delete')
@DocsEditable()

View file

@ -248,9 +248,31 @@ class AudioBufferSourceNode extends AudioSourceNode {
@DocsEditable()
void noteOn(num when) => _blink.BlinkAudioBufferSourceNode.$noteOn_Callback(this, when);
void start([num when, num grainOffset, num grainDuration]) => _blink.BlinkAudioBufferSourceNode.$start(this, when, grainOffset, grainDuration);
void start([num when, num grainOffset, num grainDuration]) {
if (grainDuration != null) {
_blink.BlinkAudioBufferSourceNode.$_start_1_Callback(this, when, grainOffset, grainDuration);
return;
}
if (grainOffset != null) {
_blink.BlinkAudioBufferSourceNode.$_start_2_Callback(this, when, grainOffset);
return;
}
if (when != null) {
_blink.BlinkAudioBufferSourceNode.$_start_3_Callback(this, when);
return;
}
_blink.BlinkAudioBufferSourceNode.$_start_4_Callback(this);
return;
}
void stop([num when]) => _blink.BlinkAudioBufferSourceNode.$stop(this, when);
void stop([num when]) {
if (when != null) {
_blink.BlinkAudioBufferSourceNode.$_stop_1_Callback(this, when);
return;
}
_blink.BlinkAudioBufferSourceNode.$_stop_2_Callback(this);
return;
}
/// Stream of `ended` events handled by this [AudioBufferSourceNode].
@DomName('AudioBufferSourceNode.onended')
@ -285,7 +307,9 @@ class AudioContext extends EventTarget {
@DomName('AudioContext.AudioContext')
@DocsEditable()
factory AudioContext() => _blink.BlinkAudioContext.$mkAudioContext();
factory AudioContext() {
return _blink.BlinkAudioContext.$_create_1constructorCallback();
}
/// Checks if this type is supported on the current platform.
static bool get supported => true;
@ -322,15 +346,30 @@ class AudioContext extends EventTarget {
@DocsEditable()
AudioBufferSourceNode createBufferSource() => _blink.BlinkAudioContext.$createBufferSource_Callback(this);
ChannelMergerNode createChannelMerger([int numberOfInputs]) => _blink.BlinkAudioContext.$createChannelMerger(this, numberOfInputs);
ChannelMergerNode createChannelMerger([int numberOfInputs]) {
if (numberOfInputs != null) {
return _blink.BlinkAudioContext.$_createChannelMerger_1_Callback(this, numberOfInputs);
}
return _blink.BlinkAudioContext.$_createChannelMerger_2_Callback(this);
}
ChannelSplitterNode createChannelSplitter([int numberOfOutputs]) => _blink.BlinkAudioContext.$createChannelSplitter(this, numberOfOutputs);
ChannelSplitterNode createChannelSplitter([int numberOfOutputs]) {
if (numberOfOutputs != null) {
return _blink.BlinkAudioContext.$_createChannelSplitter_1_Callback(this, numberOfOutputs);
}
return _blink.BlinkAudioContext.$_createChannelSplitter_2_Callback(this);
}
@DomName('AudioContext.createConvolver')
@DocsEditable()
ConvolverNode createConvolver() => _blink.BlinkAudioContext.$createConvolver_Callback(this);
DelayNode createDelay([num maxDelayTime]) => _blink.BlinkAudioContext.$createDelay(this, maxDelayTime);
DelayNode createDelay([num maxDelayTime]) {
if (maxDelayTime != null) {
return _blink.BlinkAudioContext.$_createDelay_1_Callback(this, maxDelayTime);
}
return _blink.BlinkAudioContext.$_createDelay_2_Callback(this);
}
@DomName('AudioContext.createDynamicsCompressor')
@DocsEditable()
@ -365,7 +404,18 @@ class AudioContext extends EventTarget {
@Experimental() // untriaged
PeriodicWave createPeriodicWave(Float32List real, Float32List imag) => _blink.BlinkAudioContext.$createPeriodicWave_Callback(this, real, imag);
ScriptProcessorNode createScriptProcessor([int bufferSize, int numberOfInputChannels, int numberOfOutputChannels]) => _blink.BlinkAudioContext.$createScriptProcessor(this, bufferSize, numberOfInputChannels, numberOfOutputChannels);
ScriptProcessorNode createScriptProcessor([int bufferSize, int numberOfInputChannels, int numberOfOutputChannels]) {
if (numberOfOutputChannels != null) {
return _blink.BlinkAudioContext.$_createScriptProcessor_1_Callback(this, bufferSize, numberOfInputChannels, numberOfOutputChannels);
}
if (numberOfInputChannels != null) {
return _blink.BlinkAudioContext.$_createScriptProcessor_2_Callback(this, bufferSize, numberOfInputChannels);
}
if (bufferSize != null) {
return _blink.BlinkAudioContext.$_createScriptProcessor_3_Callback(this, bufferSize);
}
return _blink.BlinkAudioContext.$_createScriptProcessor_4_Callback(this);
}
@DomName('AudioContext.createWaveShaper')
@DocsEditable()
@ -511,7 +561,17 @@ class AudioNode extends EventTarget {
@DocsEditable()
int get numberOfOutputs => _blink.BlinkAudioNode.$numberOfOutputs_Getter(this);
void _connect(destination, int output, [int input]) => _blink.BlinkAudioNode.$_connect(this, destination, output, input);
void _connect(destination, int output, [int input]) {
if ((input is int || input == null) && (output is int || output == null) && (destination is AudioNode || destination == null)) {
_blink.BlinkAudioNode.$_connect_1_Callback(this, destination, output, input);
return;
}
if ((output is int || output == null) && (destination is AudioParam || destination == null) && input == null) {
_blink.BlinkAudioNode.$_connect_2_Callback(this, destination, output);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('AudioNode.disconnect')
@DocsEditable()
@ -951,7 +1011,9 @@ class OfflineAudioContext extends AudioContext {
@DomName('OfflineAudioContext.OfflineAudioContext')
@DocsEditable()
factory OfflineAudioContext(int numberOfChannels, int numberOfFrames, num sampleRate) => _blink.BlinkOfflineAudioContext.$mkOfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
factory OfflineAudioContext(int numberOfChannels, int numberOfFrames, num sampleRate) {
return _blink.BlinkOfflineAudioContext.$_create_1constructorCallback(numberOfChannels, numberOfFrames, sampleRate);
}
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@ -1025,9 +1087,23 @@ class OscillatorNode extends AudioSourceNode {
@Experimental() // untriaged
void setPeriodicWave(PeriodicWave periodicWave) => _blink.BlinkOscillatorNode.$setPeriodicWave_Callback(this, periodicWave);
void start([num when]) => _blink.BlinkOscillatorNode.$start(this, when);
void start([num when]) {
if (when != null) {
_blink.BlinkOscillatorNode.$_start_1_Callback(this, when);
return;
}
_blink.BlinkOscillatorNode.$_start_2_Callback(this);
return;
}
void stop([num when]) => _blink.BlinkOscillatorNode.$stop(this, when);
void stop([num when]) {
if (when != null) {
_blink.BlinkOscillatorNode.$_stop_1_Callback(this, when);
return;
}
_blink.BlinkOscillatorNode.$_stop_2_Callback(this);
return;
}
/// Stream of `ended` events handled by this [OscillatorNode].
@DomName('OscillatorNode.onended')

View file

@ -2360,7 +2360,21 @@ class RenderingContext extends CanvasRenderingContext {
@DocsEditable()
void bufferByteData(int target, ByteBuffer data, int usage) => _blink.BlinkWebGLRenderingContext.$bufferByteData_Callback(this, target, data, usage);
void bufferData(int target, data_OR_size, int usage) => _blink.BlinkWebGLRenderingContext.$bufferData(this, target, data_OR_size, usage);
void bufferData(int target, data_OR_size, int usage) {
if ((usage is int || usage == null) && (data_OR_size is TypedData || data_OR_size == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_bufferData_1_Callback(this, target, data_OR_size, usage);
return;
}
if ((usage is int || usage == null) && (data_OR_size is ByteBuffer || data_OR_size == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_bufferData_2_Callback(this, target, data_OR_size, usage);
return;
}
if ((usage is int || usage == null) && (data_OR_size is int || data_OR_size == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_bufferData_3_Callback(this, target, data_OR_size, usage);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('WebGLRenderingContext.bufferDataTyped')
@DocsEditable()
@ -2370,7 +2384,17 @@ class RenderingContext extends CanvasRenderingContext {
@DocsEditable()
void bufferSubByteData(int target, int offset, ByteBuffer data) => _blink.BlinkWebGLRenderingContext.$bufferSubByteData_Callback(this, target, offset, data);
void bufferSubData(int target, int offset, data) => _blink.BlinkWebGLRenderingContext.$bufferSubData(this, target, offset, data);
void bufferSubData(int target, int offset, data) {
if ((data is TypedData || data == null) && (offset is int || offset == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_bufferSubData_1_Callback(this, target, offset, data);
return;
}
if ((data is ByteBuffer || data == null) && (offset is int || offset == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_bufferSubData_2_Callback(this, target, offset, data);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('WebGLRenderingContext.bufferSubDataTyped')
@DocsEditable()
@ -2724,7 +2748,29 @@ class RenderingContext extends CanvasRenderingContext {
@DocsEditable()
void stencilOpSeparate(int face, int fail, int zfail, int zpass) => _blink.BlinkWebGLRenderingContext.$stencilOpSeparate_Callback(this, face, fail, zfail, zpass);
void texImage2D(int target, int level, int internalformat, int format_OR_width, int height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video, [int format, int type, TypedData pixels]) => _blink.BlinkWebGLRenderingContext.$texImage2D(this, target, level, internalformat, format_OR_width, height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video, format, type, pixels);
void texImage2D(int target, int level, int internalformat, int format_OR_width, int height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video, [int format, int type, TypedData pixels]) {
if ((pixels is TypedData || pixels == null) && (type is int || type == null) && (format is int || format == null) && (border_OR_canvas_OR_image_OR_pixels_OR_video is int || border_OR_canvas_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (internalformat is int || internalformat == null) && (level is int || level == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_texImage2D_1_Callback(this, target, level, internalformat, format_OR_width, height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video, format, type, pixels);
return;
}
if ((border_OR_canvas_OR_image_OR_pixels_OR_video is ImageData || border_OR_canvas_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (internalformat is int || internalformat == null) && (level is int || level == null) && (target is int || target == null) && format == null && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texImage2D_2_Callback(this, target, level, internalformat, format_OR_width, height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video);
return;
}
if ((border_OR_canvas_OR_image_OR_pixels_OR_video is ImageElement || border_OR_canvas_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (internalformat is int || internalformat == null) && (level is int || level == null) && (target is int || target == null) && format == null && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texImage2D_3_Callback(this, target, level, internalformat, format_OR_width, height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video);
return;
}
if ((border_OR_canvas_OR_image_OR_pixels_OR_video is CanvasElement || border_OR_canvas_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (internalformat is int || internalformat == null) && (level is int || level == null) && (target is int || target == null) && format == null && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texImage2D_4_Callback(this, target, level, internalformat, format_OR_width, height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video);
return;
}
if ((border_OR_canvas_OR_image_OR_pixels_OR_video is VideoElement || border_OR_canvas_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (internalformat is int || internalformat == null) && (level is int || level == null) && (target is int || target == null) && format == null && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texImage2D_5_Callback(this, target, level, internalformat, format_OR_width, height_OR_type, border_OR_canvas_OR_image_OR_pixels_OR_video);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('WebGLRenderingContext.texImage2DCanvas')
@DocsEditable()
@ -2750,7 +2796,29 @@ class RenderingContext extends CanvasRenderingContext {
@DocsEditable()
void texParameteri(int target, int pname, int param) => _blink.BlinkWebGLRenderingContext.$texParameteri_Callback(this, target, pname, param);
void texSubImage2D(int target, int level, int xoffset, int yoffset, int format_OR_width, int height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video, [int type, TypedData pixels]) => _blink.BlinkWebGLRenderingContext.$texSubImage2D(this, target, level, xoffset, yoffset, format_OR_width, height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video, type, pixels);
void texSubImage2D(int target, int level, int xoffset, int yoffset, int format_OR_width, int height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video, [int type, TypedData pixels]) {
if ((pixels is TypedData || pixels == null) && (type is int || type == null) && (canvas_OR_format_OR_image_OR_pixels_OR_video is int || canvas_OR_format_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (yoffset is int || yoffset == null) && (xoffset is int || xoffset == null) && (level is int || level == null) && (target is int || target == null)) {
_blink.BlinkWebGLRenderingContext.$_texSubImage2D_1_Callback(this, target, level, xoffset, yoffset, format_OR_width, height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video, type, pixels);
return;
}
if ((canvas_OR_format_OR_image_OR_pixels_OR_video is ImageData || canvas_OR_format_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (yoffset is int || yoffset == null) && (xoffset is int || xoffset == null) && (level is int || level == null) && (target is int || target == null) && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texSubImage2D_2_Callback(this, target, level, xoffset, yoffset, format_OR_width, height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video);
return;
}
if ((canvas_OR_format_OR_image_OR_pixels_OR_video is ImageElement || canvas_OR_format_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (yoffset is int || yoffset == null) && (xoffset is int || xoffset == null) && (level is int || level == null) && (target is int || target == null) && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texSubImage2D_3_Callback(this, target, level, xoffset, yoffset, format_OR_width, height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video);
return;
}
if ((canvas_OR_format_OR_image_OR_pixels_OR_video is CanvasElement || canvas_OR_format_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (yoffset is int || yoffset == null) && (xoffset is int || xoffset == null) && (level is int || level == null) && (target is int || target == null) && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texSubImage2D_4_Callback(this, target, level, xoffset, yoffset, format_OR_width, height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video);
return;
}
if ((canvas_OR_format_OR_image_OR_pixels_OR_video is VideoElement || canvas_OR_format_OR_image_OR_pixels_OR_video == null) && (height_OR_type is int || height_OR_type == null) && (format_OR_width is int || format_OR_width == null) && (yoffset is int || yoffset == null) && (xoffset is int || xoffset == null) && (level is int || level == null) && (target is int || target == null) && type == null && pixels == null) {
_blink.BlinkWebGLRenderingContext.$_texSubImage2D_5_Callback(this, target, level, xoffset, yoffset, format_OR_width, height_OR_type, canvas_OR_format_OR_image_OR_pixels_OR_video);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
@DomName('WebGLRenderingContext.texSubImage2DCanvas')
@DocsEditable()

View file

@ -438,9 +438,7 @@ class HtmlDartGenerator(object):
def IsOptional(signature_index, argument):
return is_optional(operations[signature_index], argument)
emitter = \
self._native_class_emitter if self._dart_use_blink \
else self._members_emitter
emitter = self._members_emitter
self._GenerateOverloadDispatcher(
info,
@ -549,7 +547,11 @@ class HtmlDartGenerator(object):
version, signature_index, argument_count):
name = emitter.Format('_create_$VERSION', VERSION=version)
if self._dart_use_blink:
qualified_name = self.DeriveNativeName(name + 'constructorCallback')
base_name = \
self.DeriveNativeName(name + 'constructorCallback')
qualified_name = \
self.DeriveQualifiedBlinkName(self._interface.id,
base_name)
else:
qualified_name = emitter.Format(
'$FACTORY.$NAME',
@ -575,29 +577,8 @@ class HtmlDartGenerator(object):
METADATA=metadata,
PARAMS=constructor_info.ParametersAsDeclaration(self._DartType))
if self._dart_use_blink:
overload_emitter = self._native_class_emitter
mname = constructor_full_name.replace(".", "_")
blink_name = "$mk" + mname
qual_name = self.DeriveQualifiedBlinkName(
self._interface.id, blink_name)
actuals_s = constructor_info.ParametersAsStringOfVariables()
self._members_emitter.Emit(
'\n'
' $DECLARATION => $NATIVE_NAME($ACTUALS);\n',
DECLARATION=entry_declaration,
NATIVE_NAME=qual_name,
ACTUALS=actuals_s)
overload_declaration = emitter.Format(
'// Generated overload resolver\n'
' static $CTOR($PARAMS)',
CTOR=blink_name,
PARAMS=actuals_s)
else:
overload_emitter = self._members_emitter
overload_declaration = entry_declaration
overload_emitter = self._members_emitter
overload_declaration = entry_declaration
self._GenerateOverloadDispatcher(
constructor_info,

View file

@ -1250,19 +1250,26 @@ class DartiumBackend(HtmlDartGenerator):
stmts_emitter, call_emitter, version, operation, argument_count):
native_suffix = 'Callback'
actuals = info.ParametersAsListOfVariables(argument_count)
actuals_s = ", ".join(actuals)
formals=actuals
return_type = self.SecureOutputType(operation.type.id)
native_suffix = 'Callback'
is_custom = 'Custom' in operation.ext_attrs
if self._dart_use_blink:
base_name = '_%s_%s' % (operation.id, version)
overload_name = \
overload_base_name = \
self.DeriveNativeName(base_name, native_suffix)
overload_name = \
self.DeriveQualifiedBlinkName(self._interface.id,
overload_base_name)
static = True
if not operation.is_static:
actuals = ['mthis'] + actuals
actuals = ['this'] + actuals
formals = ['mthis'] + formals
actuals_s = ", ".join(actuals)
formals_s = ", ".join(formals)
dart_declaration = '%s(%s)' % (
base_name, actuals_s)
base_name, formals_s)
type_ids = [argument.type.id
for argument in operation.arguments[:argument_count]]
resolver_string = \
@ -1272,7 +1279,6 @@ class DartiumBackend(HtmlDartGenerator):
base_name = '_%s_%s' % (operation.id, version)
overload_name = base_name
static = operation.is_static
actuals_s = ", ".join(actuals)
dart_declaration = '%s%s %s(%s)' % (
'static ' if static else '',
return_type,
@ -1284,7 +1290,7 @@ class DartiumBackend(HtmlDartGenerator):
self._GenerateAutoSetupScope(base_name, native_suffix)
cpp_callback_name = self._GenerateNativeBinding(
base_name, (0 if static else 1) + argument_count,
dart_declaration, static, return_type, actuals,
dart_declaration, static, return_type, formals,
native_suffix, is_custom, auto_scope_setup, emit_metadata=False,
emit_to_native=self._dart_use_blink, resolver_string=resolver_string)
if not is_custom:
@ -1293,28 +1299,6 @@ class DartiumBackend(HtmlDartGenerator):
auto_scope_setup)
if self._dart_use_blink:
name = self.DeriveNativeName(html_name)
qual_name = self.DeriveQualifiedBlinkName(self._interface.id,
name)
actuals = info.ParametersAsListOfVariables()
formals = info.ParametersAsListOfVariables()
if not info.IsStatic():
formals = ['mthis'] + formals
actuals = ['this'] + actuals
actuals_s = ', '.join(actuals)
formals_s = ', '.join(formals)
self._members_emitter.Emit(
'\n'
' $DECLARATION => $NATIVE_NAME($ACTUALS);\n',
DECLARATION=dart_declaration,
NATIVE_NAME=qual_name,
ACTUALS=actuals_s)
dart_declaration = \
'// Generated overload resolver\n' \
' static %s(%s)' % (name, formals_s)
self._GenerateDispatcherBody(
info,
operations,

View file

@ -10,121 +10,8 @@
* up the dart:html library.
*/
library dart.dom._blink;
// TODO(leafp) These are mostly copied over from dart:html. When
// we shift dart:blink generation over to dartium, this dependency
// should go away, or at least be reconsidered.
import 'dart:async';
import 'dart:collection';
import 'dart:html';
import 'dart:_internal' hide Symbol, deprecated;
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:isolate';
import "dart:convert";
import 'dart:math';
// TODO(vsm): Remove this when we can do the proper checking in
// native code for custom elements.
import 'dart:mirrors';
import 'dart:nativewrappers';
import 'dart:typed_data';
import 'dart:web_gl' as gl;
import 'dart:web_gl' show web_glBlinkMap;
import 'dart:web_sql';
// Not actually used, but imported since dart:html can generate these objects.
import 'dart:svg' as svg;
import 'dart:svg' show Matrix;
import 'dart:svg' show SvgSvgElement;
import 'dart:svg' show svgBlinkMap;
import 'dart:web_audio' show AudioNode, AudioParam, web_audioBlinkMap;
part '$AUXILIARY_DIR/blink_native_DOMImplementation.dart';
$!GENERATED_DART_FILES
// TODO(vsm): This should be moved out of this library. Into dart:html?
Type _getType(String key) {
var result;
// TODO(vsm): Add Cross Frame and JS types here as well.
// Check the html library.
result = _getHtmlType(key);
if (result != null) {
return result;
}
// Check the web gl library.
result = _getWebGlType(key);
if (result != null) {
return result;
}
// Check the indexed db library.
result = _getIndexDbType(key);
if (result != null) {
return result;
}
// Check the web audio library.
result = _getWebAudioType(key);
if (result != null) {
return result;
}
// Check the web sql library.
result = _getWebSqlType(key);
if (result != null) {
return result;
}
// Check the svg library.
result = _getSvgType(key);
if (result != null) {
return result;
}
return null;
}
Type _getHtmlType(String key) {
if (htmlBlinkMap.containsKey(key)) {
return htmlBlinkMap[key]();
}
return null;
}
Type _getWebGlType(String key) {
if (web_glBlinkMap.containsKey(key)) {
return web_glBlinkMap[key]();
}
return null;
}
Type _getIndexDbType(String key) {
if (indexed_dbBlinkMap.containsKey(key)) {
return indexed_dbBlinkMap[key]();
}
return null;
}
Type _getWebAudioType(String key) {
if (web_audioBlinkMap.containsKey(key)) {
return web_audioBlinkMap[key]();
}
return null;
}
Type _getWebSqlType(String key) {
if (web_sqlBlinkMap.containsKey(key)) {
return web_sqlBlinkMap[key]();
}
return null;
}
Type _getSvgType(String key) {
if (svgBlinkMap.containsKey(key)) {
return svgBlinkMap[key]();
}
return null;
}

View file

@ -36,6 +36,7 @@ import 'dart:collection';
import 'dart:_internal' hide Symbol, deprecated;
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:indexed_db' show indexed_dbBlinkMap;
import 'dart:isolate';
import 'dart:js' as js;
import "dart:convert";
@ -46,12 +47,15 @@ import 'dart:mirrors';
import 'dart:nativewrappers';
import 'dart:typed_data';
import 'dart:web_gl' as gl;
import 'dart:web_gl' show web_glBlinkMap;
import 'dart:web_sql';
// Not actually used, but imported since dart:html can generate these objects.
import 'dart:svg' as svg;
import 'dart:svg' show svgBlinkMap;
import 'dart:svg' show Matrix;
import 'dart:svg' show SvgSvgElement;
import 'dart:web_audio' as web_audio;
import 'dart:web_audio' show web_audioBlinkMap;
$if DART_USE_BLINK
import 'dart:_blink' as _blink;
$endif
@ -156,4 +160,93 @@ $!TYPE_MAP
// post Chrome 35. We still generate the old mapping from 'Clipboard'.
'DataTransfer': () => DataTransfer,
};
// TODO(leafp): We may want to move this elsewhere if html becomes
// a package to avoid dartium depending on pkg:html.
Type _getType(String key) {
var result;
// TODO(vsm): Add Cross Frame and JS types here as well.
// Check the html library.
result = _getHtmlType(key);
if (result != null) {
return result;
}
// Check the web gl library.
result = _getWebGlType(key);
if (result != null) {
return result;
}
// Check the indexed db library.
result = _getIndexDbType(key);
if (result != null) {
return result;
}
// Check the web audio library.
result = _getWebAudioType(key);
if (result != null) {
return result;
}
// Check the web sql library.
result = _getWebSqlType(key);
if (result != null) {
return result;
}
// Check the svg library.
result = _getSvgType(key);
if (result != null) {
return result;
}
return null;
}
Type _getHtmlType(String key) {
if (htmlBlinkMap.containsKey(key)) {
return htmlBlinkMap[key]();
}
return null;
}
Type _getWebGlType(String key) {
if (web_glBlinkMap.containsKey(key)) {
return web_glBlinkMap[key]();
}
return null;
}
Type _getIndexDbType(String key) {
if (indexed_dbBlinkMap.containsKey(key)) {
return indexed_dbBlinkMap[key]();
}
return null;
}
Type _getWebAudioType(String key) {
if (web_audioBlinkMap.containsKey(key)) {
return web_audioBlinkMap[key]();
}
return null;
}
Type _getWebSqlType(String key) {
if (web_sqlBlinkMap.containsKey(key)) {
return web_sqlBlinkMap[key]();
}
return null;
}
Type _getSvgType(String key) {
if (svgBlinkMap.containsKey(key)) {
return svgBlinkMap[key]();
}
return null;
}
$endif