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

Side by Side Diff: tools/dom/templates/html/dartium/indexed_db_dartium.darttemplate

Issue 2978213002: Removed DARTIUM codegen for IDLS (sdk/lib/dartium) (Closed)
Patch Set: Update generated darttemplate Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // DO NOT EDIT
6 // Auto-generated dart:indexed_db library.
7
8 /**
9 * A client-side key-value store with support for indexes.
10 *
11 * Many browsers support IndexedDB—a web standard for
12 * an indexed database.
13 * By storing data on the client in an IndexedDB,
14 * a web app gets some advantages, such as faster performance and persistence.
15 * To find out which browsers support IndexedDB,
16 * refer to [Can I Use?](http://caniuse.com/#feat=indexeddb)
17 *
18 * In IndexedDB, each record is identified by a unique index or key,
19 * making data retrieval speedy.
20 * You can store structured data,
21 * such as images, arrays, and maps using IndexedDB.
22 * The standard does not specify size limits for individual data items
23 * or for the database itself, but browsers may impose storage limits.
24 *
25 * ## Using indexed_db
26 *
27 * The classes in this library provide an interface
28 * to the browser's IndexedDB, if it has one.
29 * To use this library in your code:
30 *
31 * import 'dart:indexed_db';
32 *
33 * A web app can determine if the browser supports
34 * IndexedDB with [IdbFactory.supported]:
35 *
36 * if (IdbFactory.supported)
37 * // Use indexeddb.
38 * else
39 * // Find an alternative.
40 *
41 * Access to the browser's IndexedDB is provided by the app's top-level
42 * [Window] object, which your code can refer to with `window.indexedDB`.
43 * So, for example,
44 * here's how to use window.indexedDB to open a database:
45 *
46 * Future open() {
47 * return window.indexedDB.open('myIndexedDB',
48 * version: 1,
49 * onUpgradeNeeded: _initializeDatabase)
50 * .then(_loadFromDB);
51 * }
52 * void _initializeDatabase(VersionChangeEvent e) {
53 * ...
54 * }
55 * Future _loadFromDB(Database db) {
56 * ...
57 * }
58 *
59 *
60 * All data in an IndexedDB is stored within an [ObjectStore].
61 * To manipulate the database use [Transaction]s.
62 *
63 * ## Other resources
64 *
65 * Other options for client-side data storage include:
66 *
67 * * [Window.localStorage]—a
68 * basic mechanism that stores data as a [Map],
69 * and where both the keys and the values are strings.
70 *
71 * * [dart:web_sql]—a database that can be queried with SQL.
72 *
73 * For a tutorial about using the indexed_db library with Dart,
74 * check out
75 * [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/).
76 *
77 * [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb)
78 * provides wiki-style docs about indexedDB
79 */
80 library dart.dom.indexed_db;
81
82 import 'dart:async';
83 import 'dart:html';
84 import 'dart:html_common';
85 import 'dart:nativewrappers';
86 import 'dart:_blink' as _blink;
87 import 'dart:js' as js;
88
89 $!GENERATED_DART_FILES
90
91 class _KeyRangeFactoryProvider {
92
93 static KeyRange createKeyRange_only(/*IDBKey*/ value) =>
94 KeyRange.only_(value);
95
96 static KeyRange createKeyRange_lowerBound(
97 /*IDBKey*/ bound, [bool open = false]) =>
98 KeyRange.lowerBound_(bound, open);
99
100 static KeyRange createKeyRange_upperBound(
101 /*IDBKey*/ bound, [bool open = false]) =>
102 KeyRange.upperBound_(bound, open);
103
104 static KeyRange createKeyRange_bound(
105 /*IDBKey*/ lower, /*IDBKey*/ upper,
106 [bool lowerOpen = false, bool upperOpen = false]) =>
107 KeyRange.bound_(lower, upper, lowerOpen, upperOpen);
108 }
109 // FIXME: Can we make this private?
110 @Deprecated("Internal Use Only")
111 final indexed_dbBlinkMap = {
112 $!TYPE_MAP
113 };
114
115
116 //
117 // Per http://www.w3.org/TR/IndexedDB/#key-construct
118 //
119 // "A value is said to be a valid key if it is one of the following types: Array
120 // JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [ECMA-262] or float
121 // [WEBIDL]. However Arrays are only valid keys if every item in the array is
122 // defined and is a valid key (i.e. sparse arrays can not be valid keys) and if
123 // the Array doesn't directly or indirectly contain itself. Any non-numeric
124 // properties are ignored, and thus does not affect whether the Array is a valid
125 // key. Additionally, if the value is of type float, it is only a valid key if
126 // it is not NaN, and if the value is of type Date it is only a valid key if its
127 // [[PrimitiveValue]] internal property, as defined by [ECMA-262], is not NaN."
128
129 // What is required is to ensure that an Lists in the key are actually
130 // JavaScript arrays, and any Dates are JavaScript Dates.
131
132
133 /**
134 * Converts a native IDBKey into a Dart object.
135 *
136 * May return the original input. May mutate the original input (but will be
137 * idempotent if mutation occurs). It is assumed that this conversion happens
138 * on native IDBKeys on all paths that return IDBKeys from native DOM calls.
139 *
140 * If necessary, JavaScript Dates are converted into Dart Dates.
141 */
142 _convertNativeToDart_IDBKey(nativeKey) {
143 containsDate(object) {
144 if (object is DateTime) return true;
145 if (object is List) {
146 for (int i = 0; i < object.length; i++) {
147 if (containsDate(object[i])) return true;
148 }
149 }
150 return false; // number, string.
151 }
152 if (nativeKey is DateTime) {
153 throw new UnimplementedError('Key containing DateTime');
154 }
155 // TODO: Cache conversion somewhere?
156 return nativeKey;
157 }
158
159 /**
160 * Converts a Dart object into a valid IDBKey.
161 *
162 * May return the original input. Does not mutate input.
163 *
164 * If necessary, [dartKey] may be copied to ensure all lists are converted into
165 * JavaScript Arrays and Dart Dates into JavaScript Dates.
166 */
167 _convertDartToNative_IDBKey(dartKey) {
168 // TODO: Implement.
169 return dartKey;
170 }
171
172
173
174 /// May modify original. If so, action is idempotent.
175 _convertNativeToDart_IDBAny(object) {
176 return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false);
177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698