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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits/AuditController.js

Issue 2758963002: [DevTools] Remove dependency from TargetManager to ResourceTreeModel (Closed)
Patch Set: review comments addressed Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 20 matching lines...) Expand all
31 31
32 /** 32 /**
33 * @unrestricted 33 * @unrestricted
34 */ 34 */
35 Audits.AuditController = class { 35 Audits.AuditController = class {
36 /** 36 /**
37 * @param {!Audits.AuditsPanel} auditsPanel 37 * @param {!Audits.AuditsPanel} auditsPanel
38 */ 38 */
39 constructor(auditsPanel) { 39 constructor(auditsPanel) {
40 this._auditsPanel = auditsPanel; 40 this._auditsPanel = auditsPanel;
41 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._didM ainResourceLoad, this); 41 SDK.targetManager.addModelListener(
42 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this._didMainR esourceLoad, this);
42 SDK.targetManager.addModelListener( 43 SDK.targetManager.addModelListener(
43 SDK.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this._did LoadResource, this); 44 SDK.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this._did LoadResource, this);
44 } 45 }
45 46
46 /** 47 /**
47 * @param {!SDK.Target} target 48 * @param {!SDK.Target} target
48 * @param {!Array.<!Audits.AuditCategory>} categories 49 * @param {!Array.<!Audits.AuditCategory>} categories
49 * @param {function(string, !Array.<!Audits.AuditCategoryResult>)} resultCallb ack 50 * @param {function(string, !Array.<!Audits.AuditCategoryResult>)} resultCallb ack
50 */ 51 */
51 _executeAudit(target, categories, resultCallback) { 52 _executeAudit(target, categories, resultCallback) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 135 }
135 startedCallback(); 136 startedCallback();
136 this._executeAudit(target, categories, this._auditFinishedCallback.bind(this )); 137 this._executeAudit(target, categories, this._auditFinishedCallback.bind(this ));
137 } 138 }
138 139
139 /** 140 /**
140 * @param {function()=} callback 141 * @param {function()=} callback
141 */ 142 */
142 _reloadResources(callback) { 143 _reloadResources(callback) {
143 this._pageReloadCallback = callback; 144 this._pageReloadCallback = callback;
144 SDK.targetManager.reloadPage(); 145 SDK.ResourceTreeModel.reloadAllPages();
145 } 146 }
146 147
147 _didLoadResource() { 148 _didLoadResource() {
148 if (this._pageReloadCallback && this._progress && this._progress.isCanceled( )) 149 if (this._pageReloadCallback && this._progress && this._progress.isCanceled( ))
149 this._pageReloadCallback(); 150 this._pageReloadCallback();
150 } 151 }
151 152
152 _didMainResourceLoad() { 153 /**
154 * @param {!Common.Event} event
155 */
156 _didMainResourceLoad(event) {
157 if (event.data.resourceTreeModel.target() !== SDK.targetManager.mainTarget() )
158 return;
153 if (this._pageReloadCallback) { 159 if (this._pageReloadCallback) {
154 var callback = this._pageReloadCallback; 160 var callback = this._pageReloadCallback;
155 delete this._pageReloadCallback; 161 delete this._pageReloadCallback;
156 callback(); 162 callback();
157 } 163 }
158 } 164 }
159 165
160 clearResults() { 166 clearResults() {
161 this._auditsPanel.clearResults(); 167 this._auditsPanel.clearResults();
162 } 168 }
163 }; 169 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698