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

Side by Side Diff: Source/devtools/front_end/sdk/IndexedDBModel.js

Issue 344443003: DevTools: Code fixes for the Closure compiler roll (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 6 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 /* 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 DateType: "date", 54 DateType: "date",
55 ArrayType: "array" 55 ArrayType: "array"
56 }; 56 };
57 57
58 WebInspector.IndexedDBModel.KeyPathTypes = { 58 WebInspector.IndexedDBModel.KeyPathTypes = {
59 NullType: "null", 59 NullType: "null",
60 StringType: "string", 60 StringType: "string",
61 ArrayType: "array" 61 ArrayType: "array"
62 }; 62 };
63 63
64 /**
65 * @param {*} idbKey
66 * @return {?Object}
67 */
64 WebInspector.IndexedDBModel.keyFromIDBKey = function(idbKey) 68 WebInspector.IndexedDBModel.keyFromIDBKey = function(idbKey)
65 { 69 {
66 if (typeof(idbKey) === "undefined" || idbKey === null) 70 if (typeof(idbKey) === "undefined" || idbKey === null)
67 return null; 71 return null;
68 72
69 var key = {}; 73 var key = {};
70 switch (typeof(idbKey)) { 74 switch (typeof(idbKey)) {
71 case "number": 75 case "number":
72 key.number = idbKey; 76 key.number = idbKey;
73 key.type = WebInspector.IndexedDBModel.KeyTypes.NumberType; 77 key.type = WebInspector.IndexedDBModel.KeyTypes.NumberType;
(...skipping 12 matching lines...) Expand all
86 key.array.push(WebInspector.IndexedDBModel.keyFromIDBKey(idbKey[ i])); 90 key.array.push(WebInspector.IndexedDBModel.keyFromIDBKey(idbKey[ i]));
87 key.type = WebInspector.IndexedDBModel.KeyTypes.ArrayType; 91 key.type = WebInspector.IndexedDBModel.KeyTypes.ArrayType;
88 } 92 }
89 break; 93 break;
90 default: 94 default:
91 return null; 95 return null;
92 } 96 }
93 return key; 97 return key;
94 } 98 }
95 99
100 /**
101 * @param {?IDBKeyRange=} idbKeyRange
102 * @return {?{lower: ?Object, upper: ?Object, lowerOpen: *, upperOpen: *}}
103 */
96 WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange = function(idbKeyRange) 104 WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange = function(idbKeyRange)
97 { 105 {
98 var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange; 106 if (typeof idbKeyRange === "undefined" || idbKeyRange === null)
99 if (typeof(idbKeyRange) === "undefined" || idbKeyRange === null)
100 return null; 107 return null;
101 108
102 var keyRange = {}; 109 var keyRange = {};
103 keyRange.lower = WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.lower ); 110 keyRange.lower = WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.lower );
104 keyRange.upper = WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.upper ); 111 keyRange.upper = WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.upper );
105 keyRange.lowerOpen = idbKeyRange.lowerOpen; 112 keyRange.lowerOpen = idbKeyRange.lowerOpen;
106 keyRange.upperOpen = idbKeyRange.upperOpen; 113 keyRange.upperOpen = idbKeyRange.upperOpen;
107 return keyRange; 114 return keyRange;
108 } 115 }
109 116
110 /** 117 /**
111 * @param {!IndexedDBAgent.KeyPath} keyPath 118 * @param {!IndexedDBAgent.KeyPath} keyPath
119 * @return {?string|!Array.<string>|undefined}
112 */ 120 */
113 WebInspector.IndexedDBModel.idbKeyPathFromKeyPath = function(keyPath) 121 WebInspector.IndexedDBModel.idbKeyPathFromKeyPath = function(keyPath)
114 { 122 {
115 var idbKeyPath; 123 var idbKeyPath;
116 switch (keyPath.type) { 124 switch (keyPath.type) {
117 case WebInspector.IndexedDBModel.KeyPathTypes.NullType: 125 case WebInspector.IndexedDBModel.KeyPathTypes.NullType:
118 idbKeyPath = null; 126 idbKeyPath = null;
119 break; 127 break;
120 case WebInspector.IndexedDBModel.KeyPathTypes.StringType: 128 case WebInspector.IndexedDBModel.KeyPathTypes.StringType:
121 idbKeyPath = keyPath.string; 129 idbKeyPath = keyPath.string;
122 break; 130 break;
123 case WebInspector.IndexedDBModel.KeyPathTypes.ArrayType: 131 case WebInspector.IndexedDBModel.KeyPathTypes.ArrayType:
124 idbKeyPath = keyPath.array; 132 idbKeyPath = keyPath.array;
125 break; 133 break;
126 } 134 }
127 return idbKeyPath; 135 return idbKeyPath;
128 } 136 }
129 137
138 /**
139 * @param {?string|!Array.<string>|undefined} idbKeyPath
140 * @return {?string}
141 */
130 WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath = function(idbKeyPath) 142 WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath = function(idbKeyPath)
131 { 143 {
132 if (typeof idbKeyPath === "string") 144 if (typeof idbKeyPath === "string")
133 return "\"" + idbKeyPath + "\""; 145 return "\"" + idbKeyPath + "\"";
134 if (idbKeyPath instanceof Array) 146 if (idbKeyPath instanceof Array)
135 return "[\"" + idbKeyPath.join("\", \"") + "\"]"; 147 return "[\"" + idbKeyPath.join("\", \"") + "\"]";
136 return null; 148 return null;
137 } 149 }
138 150
139 WebInspector.IndexedDBModel.EventTypes = { 151 WebInspector.IndexedDBModel.EventTypes = {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 333
322 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes .DatabaseLoaded, databaseModel); 334 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes .DatabaseLoaded, databaseModel);
323 } 335 }
324 336
325 this._agent.requestDatabase(databaseId.securityOrigin, databaseId.name, callback.bind(this)); 337 this._agent.requestDatabase(databaseId.securityOrigin, databaseId.name, callback.bind(this));
326 }, 338 },
327 339
328 /** 340 /**
329 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId 341 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId
330 * @param {string} objectStoreName 342 * @param {string} objectStoreName
331 * @param {webkitIDBKeyRange} idbKeyRange 343 * @param {?IDBKeyRange} idbKeyRange
332 * @param {number} skipCount 344 * @param {number} skipCount
333 * @param {number} pageSize 345 * @param {number} pageSize
334 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} c allback 346 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} c allback
335 */ 347 */
336 loadObjectStoreData: function(databaseId, objectStoreName, idbKeyRange, skip Count, pageSize, callback) 348 loadObjectStoreData: function(databaseId, objectStoreName, idbKeyRange, skip Count, pageSize, callback)
337 { 349 {
338 this._requestData(databaseId, databaseId.name, objectStoreName, "", idbK eyRange, skipCount, pageSize, callback); 350 this._requestData(databaseId, databaseId.name, objectStoreName, "", idbK eyRange, skipCount, pageSize, callback);
339 }, 351 },
340 352
341 /** 353 /**
342 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId 354 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId
343 * @param {string} objectStoreName 355 * @param {string} objectStoreName
344 * @param {string} indexName 356 * @param {string} indexName
345 * @param {webkitIDBKeyRange} idbKeyRange 357 * @param {?IDBKeyRange} idbKeyRange
346 * @param {number} skipCount 358 * @param {number} skipCount
347 * @param {number} pageSize 359 * @param {number} pageSize
348 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} c allback 360 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} c allback
349 */ 361 */
350 loadIndexData: function(databaseId, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback) 362 loadIndexData: function(databaseId, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback)
351 { 363 {
352 this._requestData(databaseId, databaseId.name, objectStoreName, indexNam e, idbKeyRange, skipCount, pageSize, callback); 364 this._requestData(databaseId, databaseId.name, objectStoreName, indexNam e, idbKeyRange, skipCount, pageSize, callback);
353 }, 365 },
354 366
355 /** 367 /**
356 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId 368 * @param {!WebInspector.IndexedDBModel.DatabaseId} databaseId
357 * @param {string} databaseName 369 * @param {string} databaseName
358 * @param {string} objectStoreName 370 * @param {string} objectStoreName
359 * @param {string} indexName 371 * @param {string} indexName
360 * @param {webkitIDBKeyRange} idbKeyRange 372 * @param {?IDBKeyRange} idbKeyRange
361 * @param {number} skipCount 373 * @param {number} skipCount
362 * @param {number} pageSize 374 * @param {number} pageSize
363 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} c allback 375 * @param {function(!Array.<!WebInspector.IndexedDBModel.Entry>, boolean)} c allback
364 */ 376 */
365 _requestData: function(databaseId, databaseName, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback) 377 _requestData: function(databaseId, databaseName, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback)
366 { 378 {
367 /** 379 /**
368 * @param {?Protocol.Error} error 380 * @param {?Protocol.Error} error
369 * @param {!Array.<!IndexedDBAgent.DataEntry>} dataEntries 381 * @param {!Array.<!IndexedDBAgent.DataEntry>} dataEntries
370 * @param {boolean} hasMore 382 * @param {boolean} hasMore
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 497
486 WebInspector.IndexedDBModel.Index.prototype = { 498 WebInspector.IndexedDBModel.Index.prototype = {
487 /** 499 /**
488 * @type {string} 500 * @type {string}
489 */ 501 */
490 get keyPathString() 502 get keyPathString()
491 { 503 {
492 return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyP ath); 504 return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyP ath);
493 } 505 }
494 } 506 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/DOMModel.js ('k') | Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698