OLD | NEW |
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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
8 * @param {!WebInspector.Workspace} workspace | 8 * @param {!WebInspector.Workspace} workspace |
9 * @param {!WebInspector.BreakpointManager} breakpointManager | 9 * @param {!WebInspector.BreakpointManager} breakpointManager |
10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping | 10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping |
11 */ | 11 */ |
12 WebInspector.Persistence = function(workspace, breakpointManager, fileSystemMapp
ing) | 12 WebInspector.Persistence = function(workspace, breakpointManager, fileSystemMapp
ing) |
13 { | 13 { |
14 WebInspector.Object.call(this); | 14 WebInspector.Object.call(this); |
15 this._workspace = workspace; | 15 this._workspace = workspace; |
16 this._breakpointManager = breakpointManager; | 16 this._breakpointManager = breakpointManager; |
17 /** @type {!Map<string, number>} */ | 17 /** @type {!Map<string, number>} */ |
18 this._filePathPrefixesToBindingCount = new Map(); | 18 this._filePathPrefixesToBindingCount = new Map(); |
19 | 19 |
20 this._mapping = new WebInspector.DefaultMapping(workspace, fileSystemMapping
, this._onBindingCreated.bind(this), this._onBindingRemoved.bind(this)); | 20 this._mapping = new WebInspector.DefaultMapping(workspace, fileSystemMapping
, this._onBindingCreated.bind(this), this._onBindingRemoved.bind(this)); |
21 } | 21 }; |
22 | 22 |
23 WebInspector.Persistence._binding = Symbol("Persistence.Binding"); | 23 WebInspector.Persistence._binding = Symbol("Persistence.Binding"); |
24 WebInspector.Persistence._muteCommit = Symbol("Persistence.MuteCommit"); | 24 WebInspector.Persistence._muteCommit = Symbol("Persistence.MuteCommit"); |
25 | 25 |
26 WebInspector.Persistence._NodePrefix = "(function (exports, require, module, __f
ilename, __dirname) { "; | 26 WebInspector.Persistence._NodePrefix = "(function (exports, require, module, __f
ilename, __dirname) { "; |
27 WebInspector.Persistence._NodeSuffix = "\n});" | 27 WebInspector.Persistence._NodeSuffix = "\n});"; |
28 WebInspector.Persistence._NodeShebang = "#!/usr/bin/env node\n"; | 28 WebInspector.Persistence._NodeShebang = "#!/usr/bin/env node\n"; |
29 | 29 |
30 WebInspector.Persistence.Events = { | 30 WebInspector.Persistence.Events = { |
31 BindingCreated: Symbol("BindingCreated"), | 31 BindingCreated: Symbol("BindingCreated"), |
32 BindingRemoved: Symbol("BindingRemoved") | 32 BindingRemoved: Symbol("BindingRemoved") |
33 } | 33 }; |
34 | 34 |
35 WebInspector.Persistence.prototype = { | 35 WebInspector.Persistence.prototype = { |
36 /** | 36 /** |
37 * @param {!WebInspector.PersistenceBinding} binding | 37 * @param {!WebInspector.PersistenceBinding} binding |
38 */ | 38 */ |
39 _onBindingCreated: function(binding) | 39 _onBindingCreated: function(binding) |
40 { | 40 { |
41 if (binding.network.isDirty() || binding.fileSystem.isDirty()) { | 41 if (binding.network.isDirty() || binding.fileSystem.isDirty()) { |
42 WebInspector.console.log(WebInspector.UIString("%s can not be persis
ted to file system due to unsaved changes.", binding.network.name())); | 42 WebInspector.console.log(WebInspector.UIString("%s can not be persis
ted to file system due to unsaved changes.", binding.network.name())); |
43 return; | 43 return; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 filePath += "/"; | 221 filePath += "/"; |
222 return this._filePathPrefixesToBindingCount.has(filePath); | 222 return this._filePathPrefixesToBindingCount.has(filePath); |
223 }, | 223 }, |
224 | 224 |
225 dispose: function() | 225 dispose: function() |
226 { | 226 { |
227 this._mapping.dispose(); | 227 this._mapping.dispose(); |
228 }, | 228 }, |
229 | 229 |
230 __proto__: WebInspector.Object.prototype | 230 __proto__: WebInspector.Object.prototype |
231 } | 231 }; |
232 | 232 |
233 /** | 233 /** |
234 * @constructor | 234 * @constructor |
235 * @param {!WebInspector.UISourceCode} network | 235 * @param {!WebInspector.UISourceCode} network |
236 * @param {!WebInspector.UISourceCode} fileSystem | 236 * @param {!WebInspector.UISourceCode} fileSystem |
237 */ | 237 */ |
238 WebInspector.PersistenceBinding = function(network, fileSystem) | 238 WebInspector.PersistenceBinding = function(network, fileSystem) |
239 { | 239 { |
240 this.network = network; | 240 this.network = network; |
241 this.fileSystem = fileSystem; | 241 this.fileSystem = fileSystem; |
242 } | 242 }; |
243 | 243 |
244 /** @type {!WebInspector.Persistence} */ | 244 /** @type {!WebInspector.Persistence} */ |
245 WebInspector.persistence; | 245 WebInspector.persistence; |
OLD | NEW |