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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 } | 476 } |
477 } | 477 } |
478 | 478 |
479 /** | 479 /** |
480 * @constructor | 480 * @constructor |
481 */ | 481 */ |
482 WebInspector.VersionController = function() | 482 WebInspector.VersionController = function() |
483 { | 483 { |
484 } | 484 } |
485 | 485 |
486 WebInspector.VersionController.currentVersion = 7; | 486 WebInspector.VersionController.currentVersion = 8; |
487 | 487 |
488 WebInspector.VersionController.prototype = { | 488 WebInspector.VersionController.prototype = { |
489 updateVersion: function() | 489 updateVersion: function() |
490 { | 490 { |
491 var versionSetting = WebInspector.settings.createSetting("inspectorVersi
on", 0); | 491 var versionSetting = WebInspector.settings.createSetting("inspectorVersi
on", 0); |
492 var currentVersion = WebInspector.VersionController.currentVersion; | 492 var currentVersion = WebInspector.VersionController.currentVersion; |
493 var oldVersion = versionSetting.get(); | 493 var oldVersion = versionSetting.get(); |
494 var methodsToRun = this._methodsToRunToUpdateVersion(oldVersion, current
Version); | 494 var methodsToRun = this._methodsToRunToUpdateVersion(oldVersion, current
Version); |
495 for (var i = 0; i < methodsToRun.length; ++i) | 495 for (var i = 0; i < methodsToRun.length; ++i) |
496 this[methodsToRun[i]].call(this); | 496 this[methodsToRun[i]].call(this); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 continue; | 639 continue; |
640 // Zero out saved percentage sizes, and they will be restored to def
aults. | 640 // Zero out saved percentage sizes, and they will be restored to def
aults. |
641 if (value.vertical && value.vertical.size && value.vertical.size < 1
) | 641 if (value.vertical && value.vertical.size && value.vertical.size < 1
) |
642 value.vertical.size = 0; | 642 value.vertical.size = 0; |
643 if (value.horizontal && value.horizontal.size && value.horizontal.si
ze < 1) | 643 if (value.horizontal && value.horizontal.size && value.horizontal.si
ze < 1) |
644 value.horizontal.size = 0; | 644 value.horizontal.size = 0; |
645 setting.set(value); | 645 setting.set(value); |
646 } | 646 } |
647 }, | 647 }, |
648 | 648 |
| 649 _updateVersionFrom7To8: function() |
| 650 { |
| 651 var settingName = "deviceMetrics"; |
| 652 if (!window.localStorage || !(settingName in window.localStorage)) |
| 653 return; |
| 654 var setting = WebInspector.settings.createSetting(settingName, undefined
); |
| 655 var value = setting.get(); |
| 656 if (!value) |
| 657 return; |
| 658 |
| 659 var components = value.split("x"); |
| 660 if (components.length >= 3) { |
| 661 var width = parseInt(components[0], 10); |
| 662 var height = parseInt(components[1], 10); |
| 663 var deviceScaleFactor = parseFloat(components[2]); |
| 664 if (deviceScaleFactor) { |
| 665 components[0] = "" + Math.round(width / deviceScaleFactor); |
| 666 components[1] = "" + Math.round(height / deviceScaleFactor); |
| 667 } |
| 668 } |
| 669 value = components.join("x"); |
| 670 setting.set(value); |
| 671 }, |
| 672 |
649 /** | 673 /** |
650 * @param {!WebInspector.Setting} breakpointsSetting | 674 * @param {!WebInspector.Setting} breakpointsSetting |
651 * @param {number} maxBreakpointsCount | 675 * @param {number} maxBreakpointsCount |
652 */ | 676 */ |
653 _clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCou
nt) | 677 _clearBreakpointsWhenTooMany: function(breakpointsSetting, maxBreakpointsCou
nt) |
654 { | 678 { |
655 // If there are too many breakpoints in a storage, it is likely due to a
recent bug that caused | 679 // If there are too many breakpoints in a storage, it is likely due to a
recent bug that caused |
656 // periodical breakpoints duplication leading to inspector slowness. | 680 // periodical breakpoints duplication leading to inspector slowness. |
657 if (breakpointsSetting.get().length > maxBreakpointsCount) | 681 if (breakpointsSetting.get().length > maxBreakpointsCount) |
658 breakpointsSetting.set([]); | 682 breakpointsSetting.set([]); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 { | 755 { |
732 var newValue = this._calculateValue(); | 756 var newValue = this._calculateValue(); |
733 if (newValue === this._value) | 757 if (newValue === this._value) |
734 return; | 758 return; |
735 this._value = newValue; | 759 this._value = newValue; |
736 this._eventSupport.dispatchEventToListeners(this._name, this._value); | 760 this._eventSupport.dispatchEventToListeners(this._name, this._value); |
737 } | 761 } |
738 } | 762 } |
739 | 763 |
740 WebInspector.settings.pauseOnExceptionStateString = new WebInspector.PauseOnExce
ptionStateSetting(); | 764 WebInspector.settings.pauseOnExceptionStateString = new WebInspector.PauseOnExce
ptionStateSetting(); |
OLD | NEW |