Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 27 matching lines...) Expand all Loading... | |
| 38 WebInspector.SDKModel.call(this, WebInspector.RuntimeModel, target); | 38 WebInspector.SDKModel.call(this, WebInspector.RuntimeModel, target); |
| 39 | 39 |
| 40 this._agent = target.runtimeAgent(); | 40 this._agent = target.runtimeAgent(); |
| 41 this.target().registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(t his)); | 41 this.target().registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(t his)); |
| 42 if (target.hasJSContext()) | 42 if (target.hasJSContext()) |
| 43 this._agent.enable(); | 43 this._agent.enable(); |
| 44 /** | 44 /** |
| 45 * @type {!Object.<number, !WebInspector.ExecutionContext>} | 45 * @type {!Object.<number, !WebInspector.ExecutionContext>} |
| 46 */ | 46 */ |
| 47 this._executionContextById = {}; | 47 this._executionContextById = {}; |
| 48 this._executionContextComparator = WebInspector.ExecutionContext.comparator; | |
|
pfeldman
2016/07/09 02:02:09
We can now remove the frameId-related logic from t
einbinder
2016/07/11 18:40:14
Done.
| |
| 48 | 49 |
| 49 if (WebInspector.moduleSetting("customFormatters").get()) | 50 if (WebInspector.moduleSetting("customFormatters").get()) |
| 50 this._agent.setCustomObjectFormatterEnabled(true); | 51 this._agent.setCustomObjectFormatterEnabled(true); |
| 51 | 52 |
| 52 WebInspector.moduleSetting("customFormatters").addChangeListener(this._custo mFormattersStateChanged.bind(this)); | 53 WebInspector.moduleSetting("customFormatters").addChangeListener(this._custo mFormattersStateChanged.bind(this)); |
| 53 } | 54 } |
| 54 | 55 |
| 55 WebInspector.RuntimeModel.Events = { | 56 WebInspector.RuntimeModel.Events = { |
| 56 ExecutionContextCreated: "ExecutionContextCreated", | 57 ExecutionContextCreated: "ExecutionContextCreated", |
| 57 ExecutionContextDestroyed: "ExecutionContextDestroyed", | 58 ExecutionContextDestroyed: "ExecutionContextDestroyed", |
| 58 ExecutionContextChanged: "ExecutionContextChanged" | 59 ExecutionContextChanged: "ExecutionContextChanged" |
| 59 } | 60 } |
| 60 | 61 |
| 61 WebInspector.RuntimeModel._privateScript = "private script"; | 62 WebInspector.RuntimeModel._privateScript = "private script"; |
| 62 | 63 |
| 63 WebInspector.RuntimeModel.prototype = { | 64 WebInspector.RuntimeModel.prototype = { |
| 64 | 65 |
| 65 /** | 66 /** |
| 66 * @return {!Array.<!WebInspector.ExecutionContext>} | 67 * @return {!Array.<!WebInspector.ExecutionContext>} |
| 67 */ | 68 */ |
| 68 executionContexts: function() | 69 executionContexts: function() |
| 69 { | 70 { |
| 70 return Object.values(this._executionContextById); | 71 return Object.values(this._executionContextById).sort(this.executionCont extComparator()); |
| 71 }, | 72 }, |
| 72 | 73 |
| 73 /** | 74 /** |
| 75 * @param {function(!WebInspector.ExecutionContext,!WebInspector.ExecutionCo ntext)} comparator | |
| 76 */ | |
| 77 setExecutionContextComparator: function(comparator) | |
| 78 { | |
| 79 this._executionContextComparator = comparator; | |
| 80 }, | |
| 81 | |
| 82 /** | |
| 83 * @return {function(!WebInspector.ExecutionContext,!WebInspector.ExecutionC ontext)} comparator | |
| 84 */ | |
| 85 executionContextComparator: function() | |
| 86 { | |
| 87 return this._executionContextComparator; | |
| 88 }, | |
| 89 | |
| 90 /** | |
| 74 * @return {?WebInspector.ExecutionContext} | 91 * @return {?WebInspector.ExecutionContext} |
| 75 */ | 92 */ |
| 76 defaultExecutionContext: function() | 93 defaultExecutionContext: function() |
| 77 { | 94 { |
| 78 for (var context of Object.values(this._executionContextById)) { | 95 for (var context of Object.values(this._executionContextById)) { |
| 79 if (context.isDefault) | 96 if (context.isDefault) |
| 80 return context; | 97 return context; |
| 81 } | 98 } |
| 82 return null; | 99 return null; |
| 83 }, | 100 }, |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 }, | 823 }, |
| 807 | 824 |
| 808 /** | 825 /** |
| 809 * @return {!Promise<undefined>} | 826 * @return {!Promise<undefined>} |
| 810 */ | 827 */ |
| 811 remove: function() | 828 remove: function() |
| 812 { | 829 { |
| 813 if (!this._removeFunction) | 830 if (!this._removeFunction) |
| 814 return Promise.resolve(); | 831 return Promise.resolve(); |
| 815 return this._removeFunction.callFunctionPromise(callCustomRemove, [ | 832 return this._removeFunction.callFunctionPromise(callCustomRemove, [ |
| 816 WebInspector.RemoteObject.toCallArgument(this._type), | 833 WebInspector.RemoteObject.toCallArgument(this._type), |
| 817 WebInspector.RemoteObject.toCallArgument(this._originalHandler), | 834 WebInspector.RemoteObject.toCallArgument(this._originalHandler), |
| 818 WebInspector.RemoteObject.toCallArgument(this._useCapture), | 835 WebInspector.RemoteObject.toCallArgument(this._useCapture), |
| 819 WebInspector.RemoteObject.toCallArgument(this._passive), | 836 WebInspector.RemoteObject.toCallArgument(this._passive), |
| 820 ]).then(() => undefined); | 837 ]).then(() => undefined); |
| 821 | 838 |
| 822 /** | 839 /** |
| 823 * @param {string} type | 840 * @param {string} type |
| 824 * @param {function()} listener | 841 * @param {function()} listener |
| 825 * @param {boolean} useCapture | 842 * @param {boolean} useCapture |
| 826 * @param {boolean} passive | 843 * @param {boolean} passive |
| 827 * @this {Function} | 844 * @this {Function} |
| 828 * @suppressReceiverCheck | 845 * @suppressReceiverCheck |
| 829 */ | 846 */ |
| 830 function callCustomRemove(type, listener, useCapture, passive) | 847 function callCustomRemove(type, listener, useCapture, passive) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 /** | 913 /** |
| 897 * @return {boolean} | 914 * @return {boolean} |
| 898 */ | 915 */ |
| 899 isNormalListenerType: function() | 916 isNormalListenerType: function() |
| 900 { | 917 { |
| 901 return this._listenerType === "normal"; | 918 return this._listenerType === "normal"; |
| 902 }, | 919 }, |
| 903 | 920 |
| 904 __proto__: WebInspector.SDKObject.prototype | 921 __proto__: WebInspector.SDKObject.prototype |
| 905 } | 922 } |
| OLD | NEW |