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

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

Issue 2562453003: [DevTools] Remove Common.Event.target field. (Closed)
Patch Set: works 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 // 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Persistence.Persistence = class extends Common.Object { 7 Persistence.Persistence = class extends Common.Object {
8 /** 8 /**
9 * @param {!Workspace.Workspace} workspace 9 * @param {!Workspace.Workspace} workspace
10 * @param {!Bindings.BreakpointManager} breakpointManager 10 * @param {!Bindings.BreakpointManager} breakpointManager
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 this._removeFilePathBindingPrefixes(binding.fileSystem.url()); 123 this._removeFilePathBindingPrefixes(binding.fileSystem.url());
124 124
125 this._breakpointManager.copyBreakpoints(binding.network.url(), binding.fileS ystem); 125 this._breakpointManager.copyBreakpoints(binding.network.url(), binding.fileS ystem);
126 this.dispatchEventToListeners(Persistence.Persistence.Events.BindingRemoved, binding); 126 this.dispatchEventToListeners(Persistence.Persistence.Events.BindingRemoved, binding);
127 } 127 }
128 128
129 /** 129 /**
130 * @param {!Common.Event} event 130 * @param {!Common.Event} event
131 */ 131 */
132 _onWorkingCopyChanged(event) { 132 _onWorkingCopyChanged(event) {
133 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target); 133 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
134 var binding = uiSourceCode[Persistence.Persistence._binding]; 134 var binding = uiSourceCode[Persistence.Persistence._binding];
135 if (!binding || binding[Persistence.Persistence._muteWorkingCopy]) 135 if (!binding || binding[Persistence.Persistence._muteWorkingCopy])
136 return; 136 return;
137 var other = binding.network === uiSourceCode ? binding.fileSystem : binding. network; 137 var other = binding.network === uiSourceCode ? binding.fileSystem : binding. network;
138 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); 138 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network);
139 if (target.isNodeJS()) { 139 if (target.isNodeJS()) {
140 var newContent = uiSourceCode.workingCopy(); 140 var newContent = uiSourceCode.workingCopy();
141 other.requestContent().then(() => { 141 other.requestContent().then(() => {
142 var nodeJSContent = 142 var nodeJSContent =
143 Persistence.Persistence._rewrapNodeJSContent(binding, other, other.w orkingCopy(), newContent); 143 Persistence.Persistence._rewrapNodeJSContent(binding, other, other.w orkingCopy(), newContent);
(...skipping 13 matching lines...) Expand all
157 other.setWorkingCopyGetter(workingCopyGetter); 157 other.setWorkingCopyGetter(workingCopyGetter);
158 binding[Persistence.Persistence._muteWorkingCopy] = false; 158 binding[Persistence.Persistence._muteWorkingCopy] = false;
159 this._contentSyncedForTest(); 159 this._contentSyncedForTest();
160 } 160 }
161 } 161 }
162 162
163 /** 163 /**
164 * @param {!Common.Event} event 164 * @param {!Common.Event} event
165 */ 165 */
166 _onWorkingCopyCommitted(event) { 166 _onWorkingCopyCommitted(event) {
167 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target); 167 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data.uiSour ceCode);
168 var binding = uiSourceCode[Persistence.Persistence._binding]; 168 var binding = uiSourceCode[Persistence.Persistence._binding];
169 if (!binding || binding[Persistence.Persistence._muteCommit]) 169 if (!binding || binding[Persistence.Persistence._muteCommit])
170 return; 170 return;
171 var newContent = /** @type {string} */ (event.data.content); 171 var newContent = /** @type {string} */ (event.data.content);
172 var other = binding.network === uiSourceCode ? binding.fileSystem : binding. network; 172 var other = binding.network === uiSourceCode ? binding.fileSystem : binding. network;
173 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); 173 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network);
174 if (target.isNodeJS()) { 174 if (target.isNodeJS()) {
175 other.requestContent().then(currentContent => { 175 other.requestContent().then(currentContent => {
176 var nodeJSContent = Persistence.Persistence._rewrapNodeJSContent(binding , other, currentContent, newContent); 176 var nodeJSContent = Persistence.Persistence._rewrapNodeJSContent(binding , other, currentContent, newContent);
177 setContent.call(this, nodeJSContent); 177 setContent.call(this, nodeJSContent);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 constructor(network, fileSystem, exactMatch) { 334 constructor(network, fileSystem, exactMatch) {
335 this.network = network; 335 this.network = network;
336 this.fileSystem = fileSystem; 336 this.fileSystem = fileSystem;
337 this.exactMatch = exactMatch; 337 this.exactMatch = exactMatch;
338 this._removed = false; 338 this._removed = false;
339 } 339 }
340 }; 340 };
341 341
342 /** @type {!Persistence.Persistence} */ 342 /** @type {!Persistence.Persistence} */
343 Persistence.persistence; 343 Persistence.persistence;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698