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

Unified Diff: client/dom/templates/dom/wrapping/wrapping_dom.js

Issue 9362004: Remove JS from wrapping implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: unused templates Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/dom/scripts/dartgenerator.py ('k') | client/dom/templates/dom/wrapping/wrapping_dom_externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dom/templates/dom/wrapping/wrapping_dom.js
diff --git a/client/dom/templates/dom/wrapping/wrapping_dom.js b/client/dom/templates/dom/wrapping/wrapping_dom.js
deleted file mode 100644
index ff6819e5b1a06e8acd74b87d3462726787efcf43..0000000000000000000000000000000000000000
--- a/client/dom/templates/dom/wrapping/wrapping_dom.js
+++ /dev/null
@@ -1,362 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// DO NOT EDIT
-// Auto-generated Dart DOM implementation.
-
-$!CODE
-
-function __dom_native_TimeoutHander_method(_this, callback, timeout, operation) {
- try {
- return _this.$dom[operation](__dom_unwrap_TimeoutHandler_function(callback),
- __dom_unwrap(timeout));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__DOMWindowWrappingImplementation__setInterval(_this, callback, timeout) {
- return __dom_native_TimeoutHander_method(_this, callback, timeout, 'setInterval');
-}
-
-function native__DOMWindowWrappingImplementation__setTimeout(_this, callback, timeout) {
- return __dom_native_TimeoutHander_method(_this, callback, timeout, 'setTimeout');
-}
-
-function native__WorkerContextWrappingImplementation__setInterval(_this, callback, timeout) {
- return __dom_native_TimeoutHander_method(_this, callback, timeout, 'setInterval');
-}
-
-function native__WorkerContextWrappingImplementation__setTimeout(_this, callback, timeout) {
- return __dom_native_TimeoutHander_method(_this, callback, timeout, 'setTimeout');
-}
-
-function native__DOMWindowWrappingImplementation__get_localStorage(_this) {
- var domWindow = _this.$dom;
- try {
- var isolatetoken = __dom_isolate_token();
- var wrapper = __dom_get_cached('dart_storage', domWindow, isolatetoken);
- if (wrapper) return wrapper;
- wrapper = native__StorageWrappingImplementation_create__StorageWrappingImplementation();
- wrapper.$dom = domWindow.localStorage;
- __dom_set_cached('dart_storage', domWindow, isolatetoken, wrapper)
- return wrapper;
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-// Native methods for factory providers.
-
-function native__AudioContextFactoryProvider_create() {
- try {
- var constructor = window.AudioContext || window.webkitAudioContext;
- return __dom_wrap(new constructor());
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__DOMParserFactoryProvider_create() {
- try {
- return __dom_wrap(new DOMParser());
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__FileReaderFactoryProvider_create() {
- try {
- return __dom_wrap(new FileReader());
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__F32(arg) {
- try {
- return __dom_wrap(new Float32Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__F64(arg) {
- try {
- return __dom_wrap(new Float64Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__I8(arg) {
- try {
- return __dom_wrap(new Int8Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__I16(arg) {
- try {
- return __dom_wrap(new Int16Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__I32(arg) {
- try {
- return __dom_wrap(new Int32Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__U8(arg) {
- try {
- return __dom_wrap(new Uint8Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__U16(arg) {
- try {
- return __dom_wrap(new Uint16Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__U32(arg) {
- try {
- return __dom_wrap(new Uint32Array(__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__TypedArrayFactoryProvider__U8C(arg) {
- try {
- // Use array syntax because JSCompiler doesn't know this symbol.
- return __dom_wrap(new window['Uint8ClampedArray'](__dom_unwrap(arg)));
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__WebKitCSSMatrixFactoryProvider_create(spec) {
- try {
- return __dom_wrap(new WebKitCSSMatrix(spec)); // string doesn't need unwrap.
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__WebKitPointFactoryProvider_create(x, y) {
- try {
- return __dom_wrap(new WebKitPoint(x, y)); // nums don't need unwrap.
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__WebSocketFactoryProvider_create(url) {
- try {
- return __dom_wrap(new WebSocket(url)); // string doesn't need unwrap.
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-function native__XMLHttpRequestFactoryProvider_create() {
- try {
- return __dom_wrap(new XMLHttpRequest());
- } catch (e) {
- throw __dom_wrap_exception(e);
- }
-}
-
-
-var __dom_type_map = {
-$!MAP
- // Patches for non-WebKit browsers
- 'Window': native__DOMWindowWrappingImplementation_create__DOMWindowWrappingImplementation,
- 'global': native__DOMWindowWrappingImplementation_create__DOMWindowWrappingImplementation,
- 'KeyEvent': native__KeyboardEventWrappingImplementation_create__KeyboardEventWrappingImplementation, // Opera
- 'HTMLPhraseElement': native__HTMLElementWrappingImplementation_create__HTMLElementWrappingImplementation, // IE9
- 'MSStyleCSSProperties': native__CSSStyleDeclarationWrappingImplementation_create__CSSStyleDeclarationWrappingImplementation // IE9
-};
-
-function __dom_get_class_chrome(ptr) {
- return __dom_type_map[ptr.constructor.name];
-}
-
-function __dom_get_class_generic(ptr) {
- var str = Object.prototype.toString.call(ptr);
- var name = str.substring(8, str.length - 1);
- var cls = __dom_type_map[name];
- return cls;
-}
-
-if (Object.__proto__) {
- __dom_get_class_generic = function(ptr) {
- var isolatetoken = __dom_isolate_token();
- var result = __dom_get_cached('dart_class', ptr.__proto__, isolatetoken);
- if (result) {
- return result;
- }
- var str = Object.prototype.toString.call(ptr);
- var name = str.substring(8, str.length - 1);
- var cls = __dom_type_map[name];
- __dom_set_cached('dart_class', ptr.__proto__, isolatetoken, cls);
- return cls;
- }
-}
-
-var __dom_get_class = __dom_get_class_generic;
-if (typeof window !== 'undefined' && // webworkers don't have a window
- window.constructor.name == "DOMWindow") {
- __dom_get_class = __dom_get_class_chrome;
-}
-
-function __dom_get_cached(hashtablename, obj, isolatetoken) {
- if (!obj.hasOwnProperty(hashtablename)) return (void 0);
- var hashtable = obj[hashtablename];
- var hash = isolatetoken.hashCode;
- // Issue 1005 part (1), may be undefined in CSSStyleDeclaration.
- hashtable = hashtable || {};
- while (true) {
- var result = hashtable[hash];
- if (result) {
- if (result.$token === isolatetoken) {
- return result;
- } else {
- hash++;
- }
- } else {
- return (void 0);
- }
- }
-}
-
-function __dom_set_cached(hashtablename, obj, isolatetoken, value) {
- var hashtable;
- if (!obj.hasOwnProperty(hashtablename)) {
- hashtable = {};
- obj[hashtablename] = hashtable;
- } else {
- hashtable = obj[hashtablename];
- if (!hashtable) obj[hashtablename] = hashtable = {}; // Issue 1005 part (1)
- }
- var hash = isolatetoken.hashCode;
- while (true) {
- var entry = hashtable[hash];
- if (entry) {
- if (entry.$token === isolatetoken) {
- throw "Wrapper already exists for this object: " + obj;
- } else {
- hash++;
- }
- } else {
- value.$token = isolatetoken;
- hashtable[hash] = value;
- return;
- }
- }
-}
-
-function __dom_isolate_token() {
- return isolate$current.token;
-}
-
-/** @suppress {duplicate} */
-function __dom_wrap(ptr) {
- if (ptr == null) {
- return (void 0);
- }
- var type = typeof(ptr);
- if (type != "object" && type != "function") {
- return ptr;
- }
- var isolatetoken = __dom_isolate_token();
- var wrapper = __dom_get_cached('dart_wrapper', ptr, isolatetoken);
- if (wrapper) {
- return wrapper;
- }
- var factory = __dom_get_class(ptr);
- if (!factory) {
- return ptr;
- }
- wrapper = factory();
- wrapper.$dom = ptr;
- __dom_set_cached('dart_wrapper', ptr, isolatetoken, wrapper);
- return wrapper;
-}
-
-function __dom_wrap_exception(e) {
- return __dom_wrap(e);
-}
-
-function __dom_wrap_primitive(ptr) {
- return (ptr === null) ? (void 0) : ptr;
-}
-
-/** @suppress {duplicate} */
-function __dom_unwrap(obj, dropargs) {
- if (obj == null) {
- return (void 0);
- }
- if (obj.$dom) {
- return obj.$dom;
- }
- if (obj instanceof Function) { // BUGBUG: function from other IFrame
- var isolatetoken = __dom_isolate_token();
- var unwrapped = __dom_get_cached('dart_unwrapped', obj, isolatetoken);
- if (unwrapped) {
- return unwrapped;
- }
- var isolate = isolate$current;
- unwrapped = function () {
- var old = isolate$current;
- isolate$current = isolate;
- try {
- if (dropargs) {
- return $dartcall(obj, []);
- } else {
- var args = Array.prototype.slice.call(arguments);
- return $dartcall(obj, args.map(__dom_wrap));
- }
- } finally {
- isolate$current = old;
- // TODO(vsm): This really needs to go elsewhere.
- isolate$runEventLoop();
- }
- // BUGBUG? Should the result be unwrapped? Or is it always void/bool ?
- };
- __dom_set_cached('dart_unwrapped', obj, isolatetoken, unwrapped);
- return unwrapped;
- }
- return obj;
-}
-
-function __dom_unwrap_TimeoutHandler_function(fn) {
- // Some browsers (e.g. FF) pass data to the timeout function, others do not.
- // Dart's TimeoutHandler takes no arguments, so drop any arguments passed to
- // the unwrapped callback.
- return __dom_unwrap(fn, true);
-}
-
-// Declared in src/GlobalProperties.dart
-function native__NativeDomGlobalProperties_getWindow() {
- // TODO: Should the window be obtained from an isolate?
- return __dom_wrap(window);
-}
-
-// Declared in src/GlobalProperties.dart
-function native__NativeDomGlobalProperties_getDocument() {
- // TODO: Should the window be obtained from an isolate?
- return __dom_wrap(window.document);
-}
« no previous file with comments | « client/dom/scripts/dartgenerator.py ('k') | client/dom/templates/dom/wrapping/wrapping_dom_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698