OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 return result; | 266 return result; |
267 } | 267 } |
268 | 268 |
269 /** | 269 /** |
270 * @param {string} securityOrigin | 270 * @param {string} securityOrigin |
271 * @param {string} databaseName | 271 * @param {string} databaseName |
272 */ | 272 */ |
273 _databaseAdded(securityOrigin, databaseName) { | 273 _databaseAdded(securityOrigin, databaseName) { |
274 var databaseId = new Resources.IndexedDBModel.DatabaseId(securityOrigin, dat
abaseName); | 274 var databaseId = new Resources.IndexedDBModel.DatabaseId(securityOrigin, dat
abaseName); |
275 this.dispatchEventToListeners(Resources.IndexedDBModel.Events.DatabaseAdded,
databaseId); | 275 this.dispatchEventToListeners(Resources.IndexedDBModel.Events.DatabaseAdded,
{model: this, databaseId: databaseId}); |
276 } | 276 } |
277 | 277 |
278 /** | 278 /** |
279 * @param {string} securityOrigin | 279 * @param {string} securityOrigin |
280 * @param {string} databaseName | 280 * @param {string} databaseName |
281 */ | 281 */ |
282 _databaseRemoved(securityOrigin, databaseName) { | 282 _databaseRemoved(securityOrigin, databaseName) { |
283 var databaseId = new Resources.IndexedDBModel.DatabaseId(securityOrigin, dat
abaseName); | 283 var databaseId = new Resources.IndexedDBModel.DatabaseId(securityOrigin, dat
abaseName); |
284 this.dispatchEventToListeners(Resources.IndexedDBModel.Events.DatabaseRemove
d, databaseId); | 284 this.dispatchEventToListeners( |
| 285 Resources.IndexedDBModel.Events.DatabaseRemoved, {model: this, databaseI
d: databaseId}); |
285 } | 286 } |
286 | 287 |
287 /** | 288 /** |
288 * @param {string} securityOrigin | 289 * @param {string} securityOrigin |
289 */ | 290 */ |
290 _loadDatabaseNames(securityOrigin) { | 291 _loadDatabaseNames(securityOrigin) { |
291 /** | 292 /** |
292 * @param {?Protocol.Error} error | 293 * @param {?Protocol.Error} error |
293 * @param {!Array.<string>} databaseNames | 294 * @param {!Array.<string>} databaseNames |
294 * @this {Resources.IndexedDBModel} | 295 * @this {Resources.IndexedDBModel} |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 for (var j = 0; j < objectStore.indexes.length; ++j) { | 335 for (var j = 0; j < objectStore.indexes.length; ++j) { |
335 var index = objectStore.indexes[j]; | 336 var index = objectStore.indexes[j]; |
336 var indexIDBKeyPath = Resources.IndexedDBModel.idbKeyPathFromKeyPath(i
ndex.keyPath); | 337 var indexIDBKeyPath = Resources.IndexedDBModel.idbKeyPathFromKeyPath(i
ndex.keyPath); |
337 var indexModel = | 338 var indexModel = |
338 new Resources.IndexedDBModel.Index(index.name, indexIDBKeyPath, in
dex.unique, index.multiEntry); | 339 new Resources.IndexedDBModel.Index(index.name, indexIDBKeyPath, in
dex.unique, index.multiEntry); |
339 objectStoreModel.indexes[indexModel.name] = indexModel; | 340 objectStoreModel.indexes[indexModel.name] = indexModel; |
340 } | 341 } |
341 databaseModel.objectStores[objectStoreModel.name] = objectStoreModel; | 342 databaseModel.objectStores[objectStoreModel.name] = objectStoreModel; |
342 } | 343 } |
343 | 344 |
344 this.dispatchEventToListeners(Resources.IndexedDBModel.Events.DatabaseLoad
ed, databaseModel); | 345 this.dispatchEventToListeners( |
| 346 Resources.IndexedDBModel.Events.DatabaseLoaded, {model: this, database
: databaseModel}); |
345 } | 347 } |
346 | 348 |
347 this._agent.requestDatabase(databaseId.securityOrigin, databaseId.name, call
back.bind(this)); | 349 this._agent.requestDatabase(databaseId.securityOrigin, databaseId.name, call
back.bind(this)); |
348 } | 350 } |
349 | 351 |
350 /** | 352 /** |
351 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId | 353 * @param {!Resources.IndexedDBModel.DatabaseId} databaseId |
352 * @param {string} objectStoreName | 354 * @param {string} objectStoreName |
353 * @param {?IDBKeyRange} idbKeyRange | 355 * @param {?IDBKeyRange} idbKeyRange |
354 * @param {number} skipCount | 356 * @param {number} skipCount |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 } | 534 } |
533 | 535 |
534 /** | 536 /** |
535 * @return {string} | 537 * @return {string} |
536 */ | 538 */ |
537 get keyPathString() { | 539 get keyPathString() { |
538 return /** @type {string}*/ ( | 540 return /** @type {string}*/ ( |
539 Resources.IndexedDBModel.keyPathStringFromIDBKeyPath(/** @type {string}*
/ (this.keyPath))); | 541 Resources.IndexedDBModel.keyPathStringFromIDBKeyPath(/** @type {string}*
/ (this.keyPath))); |
540 } | 542 } |
541 }; | 543 }; |
OLD | NEW |