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

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: Rebase 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.hasJSCapability())
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; 48 this._executionContextComparator = WebInspector.ExecutionContext.comparator;
49 49
50 if (WebInspector.moduleSetting("customFormatters").get()) 50 if (WebInspector.moduleSetting("customFormatters").get())
51 this._agent.setCustomObjectFormatterEnabled(true); 51 this._agent.setCustomObjectFormatterEnabled(true);
52 52
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 * @return {number} 452 * @return {number}
453 */ 453 */
454 WebInspector.ExecutionContext.comparator = function(a, b) 454 WebInspector.ExecutionContext.comparator = function(a, b)
455 { 455 {
456 /** 456 /**
457 * @param {!WebInspector.Target} target 457 * @param {!WebInspector.Target} target
458 * @return {number} 458 * @return {number}
459 */ 459 */
460 function targetWeight(target) 460 function targetWeight(target)
461 { 461 {
462 if (target.isPage()) 462 if (target.hasBrowserCapability())
463 return 3; 463 return 3;
464 if (target.isDedicatedWorker()) 464 if (target.hasJSCapability())
465 return 2; 465 return 2;
466 return 1; 466 return 1;
467 } 467 }
468 468
469 var weightDiff = targetWeight(a.target()) - targetWeight(b.target()); 469 var weightDiff = targetWeight(a.target()) - targetWeight(b.target());
470 if (weightDiff) 470 if (weightDiff)
471 return -weightDiff; 471 return -weightDiff;
472 472
473 // Main world context should always go first. 473 // Main world context should always go first.
474 if (a.isDefault) 474 if (a.isDefault)
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 /** 965 /**
966 * @return {boolean} 966 * @return {boolean}
967 */ 967 */
968 isNormalListenerType: function() 968 isNormalListenerType: function()
969 { 969 {
970 return this._listenerType === "normal"; 970 return this._listenerType === "normal";
971 }, 971 },
972 972
973 __proto__: WebInspector.SDKObject.prototype 973 __proto__: WebInspector.SDKObject.prototype
974 } 974 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698