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

Side by Side Diff: tools/dom/templates/html/impl/impl_IDBFactory.darttemplate

Issue 23055008: Making almost all dom_ methods private. Exceptions will be addressed in a later CL. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
8 /** 8 /**
9 * Checks to see if Indexed DB is supported on the current platform. 9 * Checks to see if Indexed DB is supported on the current platform.
10 */ 10 */
(...skipping 12 matching lines...) Expand all
23 Future<Database> open(String name, 23 Future<Database> open(String name,
24 {int version, void onUpgradeNeeded(VersionChangeEvent), 24 {int version, void onUpgradeNeeded(VersionChangeEvent),
25 void onBlocked(Event)}) { 25 void onBlocked(Event)}) {
26 if ((version == null) != (onUpgradeNeeded == null)) { 26 if ((version == null) != (onUpgradeNeeded == null)) {
27 return new Future.error(new ArgumentError( 27 return new Future.error(new ArgumentError(
28 'version and onUpgradeNeeded must be specified together')); 28 'version and onUpgradeNeeded must be specified together'));
29 } 29 }
30 try { 30 try {
31 var request; 31 var request;
32 if (version != null) { 32 if (version != null) {
33 request = $dom_open(name, version); 33 request = _open(name, version);
34 } else { 34 } else {
35 request = $dom_open(name); 35 request = _open(name);
36 } 36 }
37 37
38 if (onUpgradeNeeded != null) { 38 if (onUpgradeNeeded != null) {
39 request.onUpgradeNeeded.listen(onUpgradeNeeded); 39 request.onUpgradeNeeded.listen(onUpgradeNeeded);
40 } 40 }
41 if (onBlocked != null) { 41 if (onBlocked != null) {
42 request.onBlocked.listen(onBlocked); 42 request.onBlocked.listen(onBlocked);
43 } 43 }
44 return _completeRequest(request); 44 return _completeRequest(request);
45 } catch (e, stacktrace) { 45 } catch (e, stacktrace) {
46 return new Future.error(e, stacktrace); 46 return new Future.error(e, stacktrace);
47 } 47 }
48 } 48 }
49 49
50 @DomName('IDBFactory.deleteDatabase') 50 @DomName('IDBFactory.deleteDatabase')
51 Future<IdbFactory> deleteDatabase(String name, 51 Future<IdbFactory> deleteDatabase(String name,
52 {void onBlocked(Event)}) { 52 {void onBlocked(Event)}) {
53 try { 53 try {
54 var request = $dom_deleteDatabase(name); 54 var request = _deleteDatabase(name);
55 55
56 if (onBlocked != null) { 56 if (onBlocked != null) {
57 request.onBlocked.listen(onBlocked); 57 request.onBlocked.listen(onBlocked);
58 } 58 }
59 var completer = new Completer.sync(); 59 var completer = new Completer.sync();
60 request.onSuccess.listen((e) { 60 request.onSuccess.listen((e) {
61 completer.complete(this); 61 completer.complete(this);
62 }); 62 });
63 request.onError.listen((e) { 63 request.onError.listen((e) {
64 completer.completeError(e); 64 completer.completeError(e);
65 }); 65 });
66 return completer.future; 66 return completer.future;
67 } catch (e, stacktrace) { 67 } catch (e, stacktrace) {
68 return new Future.error(e, stacktrace); 68 return new Future.error(e, stacktrace);
69 } 69 }
70 } 70 }
71 71
72 @DomName('IDBFactory.getDatabaseNames') 72 @DomName('IDBFactory.getDatabaseNames')
73 @SupportedBrowser(SupportedBrowser.CHROME) 73 @SupportedBrowser(SupportedBrowser.CHROME)
74 @Experimental() 74 @Experimental()
75 Future<List<String>> getDatabaseNames() { 75 Future<List<String>> getDatabaseNames() {
76 try { 76 try {
77 var request = $dom_webkitGetDatabaseNames(); 77 var request = _webkitGetDatabaseNames();
78 78
79 return _completeRequest(request); 79 return _completeRequest(request);
80 } catch (e, stacktrace) { 80 } catch (e, stacktrace) {
81 return new Future.error(e, stacktrace); 81 return new Future.error(e, stacktrace);
82 } 82 }
83 } 83 }
84 84
85 /** 85 /**
86 * Checks to see if getDatabaseNames is supported by the current platform. 86 * Checks to see if getDatabaseNames is supported by the current platform.
87 */ 87 */
(...skipping 19 matching lines...) Expand all
107 // TODO: make sure that completer.complete is synchronous as transactions 107 // TODO: make sure that completer.complete is synchronous as transactions
108 // may be committed if the result is not processed immediately. 108 // may be committed if the result is not processed immediately.
109 request.onSuccess.listen((e) { 109 request.onSuccess.listen((e) {
110 completer.complete(request.result); 110 completer.complete(request.result);
111 }); 111 });
112 request.onError.listen((e) { 112 request.onError.listen((e) {
113 completer.completeError(e); 113 completer.completeError(e);
114 }); 114 });
115 return completer.future; 115 return completer.future;
116 } 116 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_IDBDatabase.darttemplate ('k') | tools/dom/templates/html/impl/impl_IDBIndex.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698