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

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

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 this._agent = target.pageAgent(); 48 this._agent = target.pageAgent();
49 this._agent.enable(); 49 this._agent.enable();
50 this._securityOriginManager = securityOriginManager; 50 this._securityOriginManager = securityOriginManager;
51 51
52 this._fetchResourceTree(); 52 this._fetchResourceTree();
53 53
54 target.registerPageDispatcher(new WebInspector.PageDispatcher(this)); 54 target.registerPageDispatcher(new WebInspector.PageDispatcher(this));
55 55
56 this._pendingReloadOptions = null; 56 this._pendingReloadOptions = null;
57 this._reloadSuspensionCount = 0; 57 this._reloadSuspensionCount = 0;
58 } 58 };
59 59
60 /** @enum {symbol} */ 60 /** @enum {symbol} */
61 WebInspector.ResourceTreeModel.Events = { 61 WebInspector.ResourceTreeModel.Events = {
62 FrameAdded: Symbol("FrameAdded"), 62 FrameAdded: Symbol("FrameAdded"),
63 FrameNavigated: Symbol("FrameNavigated"), 63 FrameNavigated: Symbol("FrameNavigated"),
64 FrameDetached: Symbol("FrameDetached"), 64 FrameDetached: Symbol("FrameDetached"),
65 FrameResized: Symbol("FrameResized"), 65 FrameResized: Symbol("FrameResized"),
66 FrameWillNavigate: Symbol("FrameWillNavigate"), 66 FrameWillNavigate: Symbol("FrameWillNavigate"),
67 MainFrameNavigated: Symbol("MainFrameNavigated"), 67 MainFrameNavigated: Symbol("MainFrameNavigated"),
68 ResourceAdded: Symbol("ResourceAdded"), 68 ResourceAdded: Symbol("ResourceAdded"),
69 WillLoadCachedResources: Symbol("WillLoadCachedResources"), 69 WillLoadCachedResources: Symbol("WillLoadCachedResources"),
70 CachedResourcesLoaded: Symbol("CachedResourcesLoaded"), 70 CachedResourcesLoaded: Symbol("CachedResourcesLoaded"),
71 DOMContentLoaded: Symbol("DOMContentLoaded"), 71 DOMContentLoaded: Symbol("DOMContentLoaded"),
72 Load: Symbol("Load"), 72 Load: Symbol("Load"),
73 PageReloadRequested: Symbol("PageReloadRequested"), 73 PageReloadRequested: Symbol("PageReloadRequested"),
74 WillReloadPage: Symbol("WillReloadPage"), 74 WillReloadPage: Symbol("WillReloadPage"),
75 ScreencastFrame: Symbol("ScreencastFrame"), 75 ScreencastFrame: Symbol("ScreencastFrame"),
76 ScreencastVisibilityChanged: Symbol("ScreencastVisibilityChanged"), 76 ScreencastVisibilityChanged: Symbol("ScreencastVisibilityChanged"),
77 ColorPicked: Symbol("ColorPicked"), 77 ColorPicked: Symbol("ColorPicked"),
78 InterstitialShown: Symbol("InterstitialShown"), 78 InterstitialShown: Symbol("InterstitialShown"),
79 InterstitialHidden: Symbol("InterstitialHidden") 79 InterstitialHidden: Symbol("InterstitialHidden")
80 } 80 };
81 81
82 /** 82 /**
83 * @param {!WebInspector.Target} target 83 * @param {!WebInspector.Target} target
84 * @return {?WebInspector.ResourceTreeModel} 84 * @return {?WebInspector.ResourceTreeModel}
85 */ 85 */
86 WebInspector.ResourceTreeModel.fromTarget = function(target) 86 WebInspector.ResourceTreeModel.fromTarget = function(target)
87 { 87 {
88 return /** @type {?WebInspector.ResourceTreeModel} */ (target.model(WebInspe ctor.ResourceTreeModel)); 88 return /** @type {?WebInspector.ResourceTreeModel} */ (target.model(WebInspe ctor.ResourceTreeModel));
89 } 89 };
90 90
91 /** 91 /**
92 * @return {!Array.<!WebInspector.ResourceTreeFrame>} 92 * @return {!Array.<!WebInspector.ResourceTreeFrame>}
93 */ 93 */
94 WebInspector.ResourceTreeModel.frames = function() 94 WebInspector.ResourceTreeModel.frames = function()
95 { 95 {
96 var result = []; 96 var result = [];
97 for (var target of WebInspector.targetManager.targets(WebInspector.Target.Ca pability.DOM)) 97 for (var target of WebInspector.targetManager.targets(WebInspector.Target.Ca pability.DOM))
98 result = result.concat(WebInspector.ResourceTreeModel.fromTarget(target) ._frames.valuesArray()); 98 result = result.concat(WebInspector.ResourceTreeModel.fromTarget(target) ._frames.valuesArray());
99 return result; 99 return result;
100 } 100 };
101 101
102 /** 102 /**
103 * @param {string} url 103 * @param {string} url
104 * @return {?WebInspector.Resource} 104 * @return {?WebInspector.Resource}
105 */ 105 */
106 WebInspector.ResourceTreeModel.resourceForURL = function(url) 106 WebInspector.ResourceTreeModel.resourceForURL = function(url)
107 { 107 {
108 for (var target of WebInspector.targetManager.targets(WebInspector.Target.Ca pability.DOM)) { 108 for (var target of WebInspector.targetManager.targets(WebInspector.Target.Ca pability.DOM)) {
109 var mainFrame = WebInspector.ResourceTreeModel.fromTarget(target).mainFr ame; 109 var mainFrame = WebInspector.ResourceTreeModel.fromTarget(target).mainFr ame;
110 var result = mainFrame ? mainFrame.resourceForURL(url) : null; 110 var result = mainFrame ? mainFrame.resourceForURL(url) : null;
111 if (result) 111 if (result)
112 return result; 112 return result;
113 } 113 }
114 return null; 114 return null;
115 } 115 };
116 116
117 WebInspector.ResourceTreeModel.prototype = { 117 WebInspector.ResourceTreeModel.prototype = {
118 _fetchResourceTree: function() 118 _fetchResourceTree: function()
119 { 119 {
120 /** @type {!Map<string, !WebInspector.ResourceTreeFrame>} */ 120 /** @type {!Map<string, !WebInspector.ResourceTreeFrame>} */
121 this._frames = new Map(); 121 this._frames = new Map();
122 this._cachedResourcesProcessed = false; 122 this._cachedResourcesProcessed = false;
123 this._agent.getResourceTree(this._processCachedResources.bind(this)); 123 this._agent.getResourceTree(this._processCachedResources.bind(this));
124 }, 124 },
125 125
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 if (!frameB && frameA) 469 if (!frameB && frameA)
470 return 1; 470 return 1;
471 471
472 if (frameA && frameB) { 472 if (frameA && frameB) {
473 return frameA.id.localeCompare(frameB.id); 473 return frameA.id.localeCompare(frameB.id);
474 } 474 }
475 return WebInspector.ExecutionContext.comparator(a,b); 475 return WebInspector.ExecutionContext.comparator(a,b);
476 }, 476 },
477 477
478 __proto__: WebInspector.SDKModel.prototype 478 __proto__: WebInspector.SDKModel.prototype
479 } 479 };
480 480
481 /** 481 /**
482 * @constructor 482 * @constructor
483 * @param {!WebInspector.ResourceTreeModel} model 483 * @param {!WebInspector.ResourceTreeModel} model
484 * @param {?WebInspector.ResourceTreeFrame} parentFrame 484 * @param {?WebInspector.ResourceTreeFrame} parentFrame
485 * @param {!PageAgent.FrameId} frameId 485 * @param {!PageAgent.FrameId} frameId
486 * @param {!PageAgent.Frame=} payload 486 * @param {!PageAgent.Frame=} payload
487 */ 487 */
488 WebInspector.ResourceTreeFrame = function(model, parentFrame, frameId, payload) 488 WebInspector.ResourceTreeFrame = function(model, parentFrame, frameId, payload)
489 { 489 {
(...skipping 15 matching lines...) Expand all
505 */ 505 */
506 this._childFrames = []; 506 this._childFrames = [];
507 507
508 /** 508 /**
509 * @type {!Object.<string, !WebInspector.Resource>} 509 * @type {!Object.<string, !WebInspector.Resource>}
510 */ 510 */
511 this._resourcesMap = {}; 511 this._resourcesMap = {};
512 512
513 if (this._parentFrame) 513 if (this._parentFrame)
514 this._parentFrame._childFrames.push(this); 514 this._parentFrame._childFrames.push(this);
515 } 515 };
516 516
517 /** 517 /**
518 * @param {!WebInspector.ExecutionContext|!WebInspector.CSSStyleSheetHeader|!Web Inspector.Resource} object 518 * @param {!WebInspector.ExecutionContext|!WebInspector.CSSStyleSheetHeader|!Web Inspector.Resource} object
519 * @return {?WebInspector.ResourceTreeFrame} 519 * @return {?WebInspector.ResourceTreeFrame}
520 */ 520 */
521 WebInspector.ResourceTreeFrame._fromObject = function(object) 521 WebInspector.ResourceTreeFrame._fromObject = function(object)
522 { 522 {
523 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(object.tar get()); 523 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(object.tar get());
524 var frameId = object.frameId; 524 var frameId = object.frameId;
525 if (!resourceTreeModel || !frameId) 525 if (!resourceTreeModel || !frameId)
526 return null; 526 return null;
527 return resourceTreeModel.frameForId(frameId); 527 return resourceTreeModel.frameForId(frameId);
528 } 528 };
529 529
530 /** 530 /**
531 * @param {!WebInspector.Script} script 531 * @param {!WebInspector.Script} script
532 * @return {?WebInspector.ResourceTreeFrame} 532 * @return {?WebInspector.ResourceTreeFrame}
533 */ 533 */
534 WebInspector.ResourceTreeFrame.fromScript = function(script) 534 WebInspector.ResourceTreeFrame.fromScript = function(script)
535 { 535 {
536 var executionContext = script.executionContext(); 536 var executionContext = script.executionContext();
537 if (!executionContext) 537 if (!executionContext)
538 return null; 538 return null;
539 return WebInspector.ResourceTreeFrame._fromObject(executionContext); 539 return WebInspector.ResourceTreeFrame._fromObject(executionContext);
540 } 540 };
541 541
542 /** 542 /**
543 * @param {!WebInspector.CSSStyleSheetHeader} header 543 * @param {!WebInspector.CSSStyleSheetHeader} header
544 * @return {?WebInspector.ResourceTreeFrame} 544 * @return {?WebInspector.ResourceTreeFrame}
545 */ 545 */
546 WebInspector.ResourceTreeFrame.fromStyleSheet = function(header) 546 WebInspector.ResourceTreeFrame.fromStyleSheet = function(header)
547 { 547 {
548 return WebInspector.ResourceTreeFrame._fromObject(header); 548 return WebInspector.ResourceTreeFrame._fromObject(header);
549 } 549 };
550 550
551 /** 551 /**
552 * @param {!WebInspector.Resource} resource 552 * @param {!WebInspector.Resource} resource
553 * @return {?WebInspector.ResourceTreeFrame} 553 * @return {?WebInspector.ResourceTreeFrame}
554 */ 554 */
555 WebInspector.ResourceTreeFrame.fromResource = function(resource) 555 WebInspector.ResourceTreeFrame.fromResource = function(resource)
556 { 556 {
557 return WebInspector.ResourceTreeFrame._fromObject(resource); 557 return WebInspector.ResourceTreeFrame._fromObject(resource);
558 } 558 };
559 559
560 WebInspector.ResourceTreeFrame.prototype = { 560 WebInspector.ResourceTreeFrame.prototype = {
561 /** 561 /**
562 * @return {!WebInspector.Target} 562 * @return {!WebInspector.Target}
563 */ 563 */
564 target: function() 564 target: function()
565 { 565 {
566 return this._model.target(); 566 return this._model.target();
567 }, 567 },
568 568
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 if (!this._parentFrame) 759 if (!this._parentFrame)
760 return WebInspector.UIString("top"); 760 return WebInspector.UIString("top");
761 var subtitle = new WebInspector.ParsedURL(this._url).displayName; 761 var subtitle = new WebInspector.ParsedURL(this._url).displayName;
762 if (subtitle) { 762 if (subtitle) {
763 if (!this._name) 763 if (!this._name)
764 return subtitle; 764 return subtitle;
765 return this._name + " (" + subtitle + ")"; 765 return this._name + " (" + subtitle + ")";
766 } 766 }
767 return WebInspector.UIString("<iframe>"); 767 return WebInspector.UIString("<iframe>");
768 } 768 }
769 } 769 };
770 770
771 /** 771 /**
772 * @constructor 772 * @constructor
773 * @implements {PageAgent.Dispatcher} 773 * @implements {PageAgent.Dispatcher}
774 */ 774 */
775 WebInspector.PageDispatcher = function(resourceTreeModel) 775 WebInspector.PageDispatcher = function(resourceTreeModel)
776 { 776 {
777 this._resourceTreeModel = resourceTreeModel; 777 this._resourceTreeModel = resourceTreeModel;
778 } 778 };
779 779
780 WebInspector.PageDispatcher.prototype = { 780 WebInspector.PageDispatcher.prototype = {
781 /** 781 /**
782 * @override 782 * @override
783 * @param {number} time 783 * @param {number} time
784 */ 784 */
785 domContentEventFired: function(time) 785 domContentEventFired: function(time)
786 { 786 {
787 this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTr eeModel.Events.DOMContentLoaded, time); 787 this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTr eeModel.Events.DOMContentLoaded, time);
788 }, 788 },
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 }, 929 },
930 930
931 /** 931 /**
932 * @override 932 * @override
933 */ 933 */
934 navigationRequested: function() 934 navigationRequested: function()
935 { 935 {
936 // Frontend is not interested in when navigations are requested. 936 // Frontend is not interested in when navigations are requested.
937 } 937 }
938 938
939 } 939 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698