| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Namespace for utility functions. | 6 * Namespace for utility functions. |
| 7 */ | 7 */ |
| 8 var util = {}; | 8 var util = {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 * Max number of items. | 1060 * Max number of items. |
| 1061 */ | 1061 */ |
| 1062 util.AppCache.CAPACITY = 100; | 1062 util.AppCache.CAPACITY = 100; |
| 1063 | 1063 |
| 1064 /** | 1064 /** |
| 1065 * Default lifetime. | 1065 * Default lifetime. |
| 1066 */ | 1066 */ |
| 1067 util.AppCache.LIFETIME = 30 * 24 * 60 * 60 * 1000; // 30 days. | 1067 util.AppCache.LIFETIME = 30 * 24 * 60 * 60 * 1000; // 30 days. |
| 1068 | 1068 |
| 1069 /** | 1069 /** |
| 1070 * @param {string} key Key | 1070 * @param {string} key Key. |
| 1071 * @param {function(number)} callback Callback accepting a value. | 1071 * @param {function(number)} callback Callback accepting a value. |
| 1072 */ | 1072 */ |
| 1073 util.AppCache.getValue = function(key, callback) { | 1073 util.AppCache.getValue = function(key, callback) { |
| 1074 util.AppCache.read_(function(map) { | 1074 util.AppCache.read_(function(map) { |
| 1075 var entry = map[key]; | 1075 var entry = map[key]; |
| 1076 callback(entry && entry.value); | 1076 callback(entry && entry.value); |
| 1077 }); | 1077 }); |
| 1078 }; | 1078 }; |
| 1079 | 1079 |
| 1080 /** | 1080 /** |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 * overriden). | 1251 * overriden). |
| 1252 * @param {Object} object The object. | 1252 * @param {Object} object The object. |
| 1253 * @param {string} propertyName The property name. | 1253 * @param {string} propertyName The property name. |
| 1254 * @param {*} value Value to set. | 1254 * @param {*} value Value to set. |
| 1255 */ | 1255 */ |
| 1256 util.callInheritedSetter = function(object, propertyName, value) { | 1256 util.callInheritedSetter = function(object, propertyName, value) { |
| 1257 var d = util.findPropertyDescriptor(Object.getPrototypeOf(object), | 1257 var d = util.findPropertyDescriptor(Object.getPrototypeOf(object), |
| 1258 propertyName); | 1258 propertyName); |
| 1259 d.set.call(object, value); | 1259 d.set.call(object, value); |
| 1260 }; | 1260 }; |
| OLD | NEW |