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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 */ | 323 */ |
324 function callback(error, databaseWithObjectStores) | 324 function callback(error, databaseWithObjectStores) |
325 { | 325 { |
326 if (error) { | 326 if (error) { |
327 console.error("IndexedDBAgent error: " + error); | 327 console.error("IndexedDBAgent error: " + error); |
328 return; | 328 return; |
329 } | 329 } |
330 | 330 |
331 if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin]) | 331 if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin]) |
332 return; | 332 return; |
333 var databaseModel = new WebInspector.IndexedDBModel.Database(databas
eId, databaseWithObjectStores.intVersion); | 333 var databaseModel = new WebInspector.IndexedDBModel.Database(databas
eId, databaseWithObjectStores.version); |
334 this._databases.set(databaseId, databaseModel); | 334 this._databases.set(databaseId, databaseModel); |
335 for (var i = 0; i < databaseWithObjectStores.objectStores.length; ++
i) { | 335 for (var i = 0; i < databaseWithObjectStores.objectStores.length; ++
i) { |
336 var objectStore = databaseWithObjectStores.objectStores[i]; | 336 var objectStore = databaseWithObjectStores.objectStores[i]; |
337 var objectStoreIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPa
thFromKeyPath(objectStore.keyPath); | 337 var objectStoreIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPa
thFromKeyPath(objectStore.keyPath); |
338 var objectStoreModel = new WebInspector.IndexedDBModel.ObjectSto
re(objectStore.name, objectStoreIDBKeyPath, objectStore.autoIncrement); | 338 var objectStoreModel = new WebInspector.IndexedDBModel.ObjectSto
re(objectStore.name, objectStoreIDBKeyPath, objectStore.autoIncrement); |
339 for (var j = 0; j < objectStore.indexes.length; ++j) { | 339 for (var j = 0; j < objectStore.indexes.length; ++j) { |
340 var index = objectStore.indexes[j]; | 340 var index = objectStore.indexes[j]; |
341 var indexIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPat
hFromKeyPath(index.keyPath); | 341 var indexIDBKeyPath = WebInspector.IndexedDBModel.idbKeyPat
hFromKeyPath(index.keyPath); |
342 var indexModel = new WebInspector.IndexedDBModel.Index(inde
x.name, indexIDBKeyPath, index.unique, index.multiEntry); | 342 var indexModel = new WebInspector.IndexedDBModel.Index(inde
x.name, indexIDBKeyPath, index.unique, index.multiEntry); |
343 objectStoreModel.indexes[indexModel.name] = indexModel; | 343 objectStoreModel.indexes[indexModel.name] = indexModel; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 * @return {boolean} | 452 * @return {boolean} |
453 */ | 453 */ |
454 equals: function(databaseId) | 454 equals: function(databaseId) |
455 { | 455 { |
456 return this.name === databaseId.name && this.securityOrigin === database
Id.securityOrigin; | 456 return this.name === databaseId.name && this.securityOrigin === database
Id.securityOrigin; |
457 }, | 457 }, |
458 } | 458 } |
459 /** | 459 /** |
460 * @constructor | 460 * @constructor |
461 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId | 461 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId |
462 * @param {number} intVersion | 462 * @param {number} version |
463 */ | 463 */ |
464 WebInspector.IndexedDBModel.Database = function(databaseId, intVersion) | 464 WebInspector.IndexedDBModel.Database = function(databaseId, version) |
465 { | 465 { |
466 this.databaseId = databaseId; | 466 this.databaseId = databaseId; |
467 this.intVersion = intVersion; | 467 this.version = version; |
468 this.objectStores = {}; | 468 this.objectStores = {}; |
469 } | 469 } |
470 | 470 |
471 /** | 471 /** |
472 * @constructor | 472 * @constructor |
473 * @param {string} name | 473 * @param {string} name |
474 * @param {*} keyPath | 474 * @param {*} keyPath |
475 * @param {boolean} autoIncrement | 475 * @param {boolean} autoIncrement |
476 */ | 476 */ |
477 WebInspector.IndexedDBModel.ObjectStore = function(name, keyPath, autoIncrement) | 477 WebInspector.IndexedDBModel.ObjectStore = function(name, keyPath, autoIncrement) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 * @param {!WebInspector.Target} target | 521 * @param {!WebInspector.Target} target |
522 * @return {?WebInspector.IndexedDBModel} | 522 * @return {?WebInspector.IndexedDBModel} |
523 */ | 523 */ |
524 WebInspector.IndexedDBModel.fromTarget = function(target) | 524 WebInspector.IndexedDBModel.fromTarget = function(target) |
525 { | 525 { |
526 var model = /** @type {?WebInspector.IndexedDBModel} */ (target.model(WebIns
pector.IndexedDBModel)); | 526 var model = /** @type {?WebInspector.IndexedDBModel} */ (target.model(WebIns
pector.IndexedDBModel)); |
527 if (!model) | 527 if (!model) |
528 model = new WebInspector.IndexedDBModel(target); | 528 model = new WebInspector.IndexedDBModel(target); |
529 return model; | 529 return model; |
530 } | 530 } |
OLD | NEW |