Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 device["show"] = "Default"; | 558 device["show"] = "Default"; |
| 559 newList.push(device); | 559 newList.push(device); |
| 560 } | 560 } |
| 561 if (newList.length) | 561 if (newList.length) |
| 562 WebInspector.settings.createSetting(newSettingName, []).set(newList) ; | 562 WebInspector.settings.createSetting(newSettingName, []).set(newList) ; |
| 563 oldSetting.remove(); | 563 oldSetting.remove(); |
| 564 }, | 564 }, |
| 565 | 565 |
| 566 _updateVersionFrom11To12: function() | 566 _updateVersionFrom11To12: function() |
| 567 { | 567 { |
| 568 this._migrateSettingsFromLocalStorage(); | |
|
pfeldman
2015/06/23 13:58:02
We can't modify things in the past, assume users a
alph
2015/06/23 14:11:36
you probably took it offline, but could you please
| |
| 569 }, | |
| 570 | |
| 571 _updateVersionFrom12To13: function() | |
| 572 { | |
| 573 this._migrateSettingsFromLocalStorage(); | |
|
pfeldman
2015/06/23 13:58:03
You should not migrate more than once. Should we j
| |
| 574 WebInspector.settings.createSetting("timelineOverviewMode", "").remove() ; | |
| 575 }, | |
| 576 | |
| 577 _migrateSettingsFromLocalStorage: function() | |
| 578 { | |
| 568 // This step migrates all the settings except for the ones below into th e browser profile. | 579 // This step migrates all the settings except for the ones below into th e browser profile. |
| 569 var localSettings = [ "advancedSearchConfig", "breakpoints", "consoleHis tory", "domBreakpoints", "eventListenerBreakpoints", | 580 var localSettings = [ "advancedSearchConfig", "breakpoints", "consoleHis tory", "domBreakpoints", "eventListenerBreakpoints", |
| 570 "fileSystemMapping", "lastSelectedSourcesSidebarPa neTab", "previouslyViewedFiles", | 581 "fileSystemMapping", "lastSelectedSourcesSidebarPa neTab", "previouslyViewedFiles", |
| 571 "savedURLs", "watchExpressions", "workspaceExclude dFolders", "xhrBreakpoints" ].keySet(); | 582 "savedURLs", "watchExpressions", "workspaceExclude dFolders", "xhrBreakpoints" ].keySet(); |
| 572 if (!window.localStorage) | 583 if (!window.localStorage) |
| 573 return; | 584 return; |
| 574 | 585 |
| 575 for (var key in window.localStorage) { | 586 for (var key in window.localStorage) { |
| 576 if (key in localSettings) | 587 if (key in localSettings) |
| 577 continue; | 588 continue; |
| 578 var value = window.localStorage[key]; | 589 var value = window.localStorage[key]; |
| 579 window.localStorage.removeItem(key); | 590 window.localStorage.removeItem(key); |
| 580 WebInspector.settings._settingsStorage[key] = value; | 591 WebInspector.settings._settingsStorage[key] = value; |
| 581 } | 592 } |
| 582 }, | 593 }, |
| 583 | 594 |
| 584 _updateVersionFrom12To13: function() | |
| 585 { | |
| 586 WebInspector.settings.createSetting("timelineOverviewMode", "").remove() ; | |
| 587 }, | |
| 588 | |
| 589 /** | 595 /** |
| 590 * @param {!WebInspector.Setting} breakpointsSetting | 596 * @param {!WebInspector.Setting} breakpointsSetting |
| 591 * @param {number} maxBreakpointsCount | 597 * @param {number} maxBreakpointsCount |
| 592 */ | 598 */ |
| 593 _clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCou nt) | 599 _clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCou nt) |
| 594 { | 600 { |
| 595 // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused | 601 // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused |
| 596 // periodical breakpoints duplication leading to inspector slowness. | 602 // periodical breakpoints duplication leading to inspector slowness. |
| 597 if (breakpointsSetting.get().length > maxBreakpointsCount) | 603 if (breakpointsSetting.get().length > maxBreakpointsCount) |
| 598 breakpointsSetting.set([]); | 604 breakpointsSetting.set([]); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 614 } | 620 } |
| 615 | 621 |
| 616 /** | 622 /** |
| 617 * @param {string} settingName | 623 * @param {string} settingName |
| 618 * @return {!WebInspector.Setting} | 624 * @return {!WebInspector.Setting} |
| 619 */ | 625 */ |
| 620 WebInspector.settingForTest = function(settingName) | 626 WebInspector.settingForTest = function(settingName) |
| 621 { | 627 { |
| 622 return WebInspector.settings.settingForTest(settingName); | 628 return WebInspector.settings.settingForTest(settingName); |
| 623 } | 629 } |
| OLD | NEW |