Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/hosted_mode/cache.js |
| diff --git a/third_party/WebKit/Source/devtools/hosted_mode/cache.js b/third_party/WebKit/Source/devtools/hosted_mode/cache.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1cb6e162c306f956a5481fde3f2f8efdac8df7b7 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/devtools/hosted_mode/cache.js |
| @@ -0,0 +1,35 @@ |
| +var Cache = function() |
|
lushnikov
2016/07/22 02:56:21
inline this all into protocol_files_proxy.js
chenwilliam
2016/07/22 17:35:25
Done.
|
| +{ |
| + this._data = new Map(); |
| + this._version = null; |
| +}; |
| + |
| +Cache.prototype = { |
| + |
| + setVersion: function(version) |
| + { |
| + this._version = version; |
| + }, |
| + |
| + hasFile: function(file) |
| + { |
| + return this._data.has(this._getKey(file)); |
| + }, |
| + |
| + getFile: function(file) |
| + { |
| + return this._data.get(this._getKey(file)); |
| + }, |
| + |
| + cacheFile: function(file, data) |
| + { |
| + this._data.set(this._getKey(file), data); |
| + }, |
| + |
| + _getKey: function(file) |
| + { |
| + return `${file}__version:${this._version}`; |
| + } |
| +}; |
| + |
| +module.exports = Cache; |