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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js

Issue 2588503002: DevTools: Cache the original content on UISourceCode (Closed)
Patch Set: Move logic to the project level Created 4 years 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 forceLoadOnCheckContent() { 284 forceLoadOnCheckContent() {
285 this._forceLoadOnCheckContent = true; 285 this._forceLoadOnCheckContent = true;
286 } 286 }
287 287
288 /** 288 /**
289 * @return {!Promise<?string>} 289 * @return {!Promise<?string>}
290 */ 290 */
291 requestOriginalContent() { 291 requestOriginalContent() {
292 var callback; 292 return this._project.requestOriginalFileContent(this);
293 var promise = new Promise(fulfill => callback = fulfill);
294 this._project.requestFileContent(this, callback);
295 return promise;
296 } 293 }
297 294
298 /** 295 /**
299 * @param {string} content 296 * @param {string} content
300 */ 297 */
301 _commitContent(content) { 298 _commitContent(content) {
302 if (this._project.canSetFileContent()) { 299 if (this._project.canSetFileContent()) {
303 this._project.setFileContent(this, content, function() {}); 300 this._project.setFileContent(this, content, function() {});
304 } else if (this._url && Workspace.fileManager.isURLSaved(this._url)) { 301 } else if (this._url && Workspace.fileManager.isURLSaved(this._url)) {
305 Workspace.fileManager.save(this._url, content, false, function() {}); 302 Workspace.fileManager.save(this._url, content, false, function() {});
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 Workspace.UISourceCodeMetadata = class { 904 Workspace.UISourceCodeMetadata = class {
908 /** 905 /**
909 * @param {?Date} modificationTime 906 * @param {?Date} modificationTime
910 * @param {?number} contentSize 907 * @param {?number} contentSize
911 */ 908 */
912 constructor(modificationTime, contentSize) { 909 constructor(modificationTime, contentSize) {
913 this.modificationTime = modificationTime; 910 this.modificationTime = modificationTime;
914 this.contentSize = contentSize; 911 this.contentSize = contentSize;
915 } 912 }
916 }; 913 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698