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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js

Issue 2034533002: [DevTools] Add removeFunction to EventListener protocol object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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 /* 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 return this._removeFunction; 803 return this._removeFunction;
804 }, 804 },
805 805
806 /** 806 /**
807 * @return {!Promise<undefined>} 807 * @return {!Promise<undefined>}
808 */ 808 */
809 remove: function() 809 remove: function()
810 { 810 {
811 if (!this._removeFunction) 811 if (!this._removeFunction)
812 return Promise.resolve(); 812 return Promise.resolve();
813 return new Promise(promiseConstructor.bind(this)); 813 return this._removeFunction.callFunctionPromise(callCustomRemove, [
814
815 /**
816 * @param {function()} success
817 * @this {WebInspector.EventListener}
818 */
819 function promiseConstructor(success)
820 {
821 this._removeFunction.callFunction(callCustomRemove, [
822 WebInspector.RemoteObject.toCallArgument(this._removeFunction), 814 WebInspector.RemoteObject.toCallArgument(this._removeFunction),
823 WebInspector.RemoteObject.toCallArgument(this._type), 815 WebInspector.RemoteObject.toCallArgument(this._type),
824 WebInspector.RemoteObject.toCallArgument(this._originalHandler), 816 WebInspector.RemoteObject.toCallArgument(this._originalHandler),
825 WebInspector.RemoteObject.toCallArgument(this._useCapture), 817 WebInspector.RemoteObject.toCallArgument(this._useCapture),
826 WebInspector.RemoteObject.toCallArgument(this._passive), 818 WebInspector.RemoteObject.toCallArgument(this._passive),
827 ], success); 819 ]).then(() => undefined);
828 820
829 /** 821 /**
830 * @param {function(string, function(), boolean, boolean)} func 822 * @param {function(string, function(), boolean, boolean)} func
831 * @param {string} type 823 * @param {string} type
832 * @param {function()} listener 824 * @param {function()} listener
833 * @param {boolean} useCapture 825 * @param {boolean} useCapture
834 * @param {boolean} passive 826 * @param {boolean} passive
835 */ 827 */
836 function callCustomRemove(func, type, listener, useCapture, passive) 828 function callCustomRemove(func, type, listener, useCapture, passive)
837 { 829 {
838 func.call(null, type, listener, useCapture, passive); 830 func.call(null, type, listener, useCapture, passive);
dgozman 2016/06/01 23:54:05 Let's use |this| instead of |func|.
kozy 2016/06/02 01:04:39 Done.
839 }
840 } 831 }
841 }, 832 },
842 833
843 /** 834 /**
844 * @return {string} 835 * @return {string}
845 */ 836 */
846 listenerType: function() 837 listenerType: function()
847 { 838 {
848 return this._listenerType; 839 return this._listenerType;
849 }, 840 },
850 841
851 /** 842 /**
852 * @param {string} listenerType 843 * @param {string} listenerType
853 */ 844 */
854 setListenerType: function(listenerType) 845 setListenerType: function(listenerType)
855 { 846 {
856 this._listenerType = listenerType; 847 this._listenerType = listenerType;
857 }, 848 },
858 849
859 __proto__: WebInspector.SDKObject.prototype 850 __proto__: WebInspector.SDKObject.prototype
860 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698