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

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

Issue 2137773002: [DevTools] Replace the target type with capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [DevTools] Replace target type with capabilities Created 4 years, 5 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 21 matching lines...) Expand all
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.SDKModel} 33 * @extends {WebInspector.SDKModel}
34 * @param {!WebInspector.Target} target 34 * @param {!WebInspector.Target} target
35 */ 35 */
36 WebInspector.RuntimeModel = function(target) 36 WebInspector.RuntimeModel = function(target)
37 { 37 {
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.hasJSDomains())
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 48
49 if (WebInspector.moduleSetting("customFormatters").get()) 49 if (WebInspector.moduleSetting("customFormatters").get())
50 this._agent.setCustomObjectFormatterEnabled(true); 50 this._agent.setCustomObjectFormatterEnabled(true);
51 51
52 WebInspector.moduleSetting("customFormatters").addChangeListener(this._custo mFormattersStateChanged.bind(this)); 52 WebInspector.moduleSetting("customFormatters").addChangeListener(this._custo mFormattersStateChanged.bind(this));
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 * @return {number} 435 * @return {number}
436 */ 436 */
437 WebInspector.ExecutionContext.comparator = function(a, b) 437 WebInspector.ExecutionContext.comparator = function(a, b)
438 { 438 {
439 /** 439 /**
440 * @param {!WebInspector.Target} target 440 * @param {!WebInspector.Target} target
441 * @return {number} 441 * @return {number}
442 */ 442 */
443 function targetWeight(target) 443 function targetWeight(target)
444 { 444 {
445 if (target.isPage()) 445 if (target.hasBrowserDomains())
446 return 3; 446 return 3;
447 if (target.isDedicatedWorker()) 447 if (!target.hasJSDomains())
dgozman 2016/07/12 00:34:11 This should be inverted.
eostroukhov-old 2016/07/12 21:46:15 Done.
448 return 2; 448 return 2;
449 return 1; 449 return 1;
450 } 450 }
451 451
452 var weightDiff = targetWeight(a.target()) - targetWeight(b.target()); 452 var weightDiff = targetWeight(a.target()) - targetWeight(b.target());
453 if (weightDiff) 453 if (weightDiff)
454 return -weightDiff; 454 return -weightDiff;
455 455
456 var frameIdDiff = String.hashCode(a.frameId) - String.hashCode(b.frameId); 456 var frameIdDiff = String.hashCode(a.frameId) - String.hashCode(b.frameId);
457 if (frameIdDiff) 457 if (frameIdDiff)
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 }, 862 },
863 863
864 /** 864 /**
865 * @return {!Promise<undefined>} 865 * @return {!Promise<undefined>}
866 */ 866 */
867 remove: function() 867 remove: function()
868 { 868 {
869 if (!this._removeFunction) 869 if (!this._removeFunction)
870 return Promise.resolve(); 870 return Promise.resolve();
871 return this._removeFunction.callFunctionPromise(callCustomRemove, [ 871 return this._removeFunction.callFunctionPromise(callCustomRemove, [
872 WebInspector.RemoteObject.toCallArgument(this._type), 872 WebInspector.RemoteObject.toCallArgument(this._type),
873 WebInspector.RemoteObject.toCallArgument(this._originalHandler), 873 WebInspector.RemoteObject.toCallArgument(this._originalHandler),
874 WebInspector.RemoteObject.toCallArgument(this._useCapture), 874 WebInspector.RemoteObject.toCallArgument(this._useCapture),
875 WebInspector.RemoteObject.toCallArgument(this._passive), 875 WebInspector.RemoteObject.toCallArgument(this._passive),
876 ]).then(() => undefined); 876 ]).then(() => undefined);
877 877
878 /** 878 /**
879 * @param {string} type 879 * @param {string} type
880 * @param {function()} listener 880 * @param {function()} listener
881 * @param {boolean} useCapture 881 * @param {boolean} useCapture
882 * @param {boolean} passive 882 * @param {boolean} passive
883 * @this {Function} 883 * @this {Function}
884 * @suppressReceiverCheck 884 * @suppressReceiverCheck
885 */ 885 */
886 function callCustomRemove(type, listener, useCapture, passive) 886 function callCustomRemove(type, listener, useCapture, passive)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 /** 952 /**
953 * @return {boolean} 953 * @return {boolean}
954 */ 954 */
955 isNormalListenerType: function() 955 isNormalListenerType: function()
956 { 956 {
957 return this._listenerType === "normal"; 957 return this._listenerType === "normal";
958 }, 958 },
959 959
960 __proto__: WebInspector.SDKObject.prototype 960 __proto__: WebInspector.SDKObject.prototype
961 } 961 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698