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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js

Issue 2868543002: DevTools: move FileSystemMapping under persistence/ module (Closed)
Patch Set: fix copyright Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /**
6 * @implements {Persistence.MappingSystem}
5 * @unrestricted 7 * @unrestricted
6 */ 8 */
7 Persistence.Automapping = class { 9 Persistence.Automapping = class {
8 /** 10 /**
9 * @param {!Workspace.Workspace} workspace 11 * @param {!Workspace.Workspace} workspace
10 * @param {function(!Persistence.PersistenceBinding)} onBindingCreated 12 * @param {function(!Persistence.PersistenceBinding)} onBindingCreated
11 * @param {function(!Persistence.PersistenceBinding)} onBindingRemoved 13 * @param {function(!Persistence.PersistenceBinding)} onBindingRemoved
12 */ 14 */
13 constructor(workspace, onBindingCreated, onBindingRemoved) { 15 constructor(workspace, onBindingCreated, onBindingRemoved) {
14 this._workspace = workspace; 16 this._workspace = workspace;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (!fileMetadata) 295 if (!fileMetadata)
294 return false; 296 return false;
295 // Allow a second of difference due to network timestamps lack of precisio n. 297 // Allow a second of difference due to network timestamps lack of precisio n.
296 var timeMatches = !networkMetadata.modificationTime || 298 var timeMatches = !networkMetadata.modificationTime ||
297 Math.abs(networkMetadata.modificationTime - fileMetadata.modificationT ime) < 1000; 299 Math.abs(networkMetadata.modificationTime - fileMetadata.modificationT ime) < 1000;
298 var contentMatches = !networkMetadata.contentSize || fileMetadata.contentS ize === networkMetadata.contentSize; 300 var contentMatches = !networkMetadata.contentSize || fileMetadata.contentS ize === networkMetadata.contentSize;
299 return timeMatches && contentMatches; 301 return timeMatches && contentMatches;
300 }); 302 });
301 } 303 }
302 304
305 /**
306 * @override
307 */
303 dispose() { 308 dispose() {
304 if (this._disposed) 309 if (this._disposed)
305 return; 310 return;
306 this._disposed = true; 311 this._disposed = true;
307 Common.EventTarget.removeEventListeners(this._eventListeners); 312 Common.EventTarget.removeEventListeners(this._eventListeners);
308 for (var binding of this._bindings.valuesArray()) 313 for (var binding of this._bindings.valuesArray())
309 this._unbindNetwork(binding.network); 314 this._unbindNetwork(binding.network);
310 } 315 }
311 }; 316 };
312 317
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 /** 438 /**
434 * @param {string} path 439 * @param {string} path
435 * @return {string} 440 * @return {string}
436 */ 441 */
437 closestParentFolder(path) { 442 closestParentFolder(path) {
438 var encodedPath = this._encoder.encode(path); 443 var encodedPath = this._encoder.encode(path);
439 var commonPrefix = this._index.longestPrefix(encodedPath, true); 444 var commonPrefix = this._index.longestPrefix(encodedPath, true);
440 return this._encoder.decode(commonPrefix); 445 return this._encoder.decode(commonPrefix);
441 } 446 }
442 }; 447 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698