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

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

Issue 2865573003: DevTools: support live coverage (Closed)
Patch Set: fixed accidentally creating too many promises for one resource Created 3 years, 7 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 this._fireStyleSheetChanged(styleSheetId, edit); 288 this._fireStyleSheetChanged(styleSheetId, edit);
289 return true; 289 return true;
290 } 290 }
291 291
292 Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited); 292 Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
293 return this._ensureOriginalStyleSheetText(styleSheetId) 293 return this._ensureOriginalStyleSheetText(styleSheetId)
294 .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callba ck.bind(this))) 294 .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callba ck.bind(this)))
295 .catchException(false); 295 .catchException(false);
296 } 296 }
297 297
298 startRuleUsageTracking() { 298 startCoverage() {
299 this._agent.startRuleUsageTracking(); 299 this._agent.startRuleUsageTracking();
300 } 300 }
301 301
302 /** 302 /**
303 * @return {!Promise<!Array<!Protocol.CSS.RuleUsage>>} 303 * @return {!Promise<!Array<!Protocol.CSS.RuleUsage>>}
304 */ 304 */
305 ruleListPromise() { 305 takeCoverageDelta() {
306 /** 306 return this._agent.takeCoverageDelta((error, ruleUsage) => error || !ruleUsa ge ? [] : ruleUsage);
307 * @param {?string} error
308 * @param {!Array<!Protocol.CSS.RuleUsage>=} ruleUsage
309 * @return {!Array<!Protocol.CSS.RuleUsage>}
310 */
311 function usedRulesCallback(error, ruleUsage) {
312 if (error || !ruleUsage)
313 return [];
314
315 return ruleUsage;
316 }
317
318 return this._agent.stopRuleUsageTracking(usedRulesCallback);
319 } 307 }
320 308
321 /** 309 /**
310 * @return {!Promise}
311 */
312 stopCoverage() {
313 return this._agent.stopRuleUsageTracking((error, ruleUsage) => {});
alph 2017/05/05 19:18:09 drop the callback
314 }
315
316 /**
322 * @return {!Promise.<!Array.<!SDK.CSSMedia>>} 317 * @return {!Promise.<!Array.<!SDK.CSSMedia>>}
323 */ 318 */
324 mediaQueriesPromise() { 319 mediaQueriesPromise() {
325 /** 320 /**
326 * @param {?Protocol.Error} error 321 * @param {?Protocol.Error} error
327 * @param {?Array.<!Protocol.CSS.CSSMedia>} payload 322 * @param {?Array.<!Protocol.CSS.CSSMedia>} payload
328 * @return {!Array.<!SDK.CSSMedia>} 323 * @return {!Array.<!SDK.CSSMedia>}
329 * @this {!SDK.CSSModel} 324 * @this {!SDK.CSSModel}
330 */ 325 */
331 function parsePayload(error, payload) { 326 function parsePayload(error, payload) {
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 SDK.CSSModel.InlineStyleResult = class { 1025 SDK.CSSModel.InlineStyleResult = class {
1031 /** 1026 /**
1032 * @param {?SDK.CSSStyleDeclaration} inlineStyle 1027 * @param {?SDK.CSSStyleDeclaration} inlineStyle
1033 * @param {?SDK.CSSStyleDeclaration} attributesStyle 1028 * @param {?SDK.CSSStyleDeclaration} attributesStyle
1034 */ 1029 */
1035 constructor(inlineStyle, attributesStyle) { 1030 constructor(inlineStyle, attributesStyle) {
1036 this.inlineStyle = inlineStyle; 1031 this.inlineStyle = inlineStyle;
1037 this.attributesStyle = attributesStyle; 1032 this.attributesStyle = attributesStyle;
1038 } 1033 }
1039 }; 1034 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698