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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/CSSParser.js

Issue 2572053002: DevTools: kill SDK.CSSParser (Closed)
Patch Set: address comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/CSSParser.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CSSParser.js b/third_party/WebKit/Source/devtools/front_end/sdk/CSSParser.js
deleted file mode 100644
index b003f8230781f2f7a34da688fa4ea3504e258641..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/devtools/front_end/sdk/CSSParser.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Copyright 2014 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**
- * @unrestricted
- */
-SDK.CSSParser = class extends Common.Object {
- constructor() {
- super();
- this._rules = [];
- this._terminated = false;
- }
-
- /**
- * @param {!SDK.CSSStyleSheetHeader} styleSheetHeader
- * @param {function(!Array.<!Common.FormatterWorkerPool.CSSRule>)=} callback
- */
- fetchAndParse(styleSheetHeader, callback) {
- this._lock();
- this._finishedCallback = callback;
- styleSheetHeader.requestContent().then(this._innerParse.bind(this));
- }
-
- /**
- * @param {string} text
- * @param {function(!Array.<!Common.FormatterWorkerPool.CSSRule>)=} callback
- */
- parse(text, callback) {
- this._lock();
- this._finishedCallback = callback;
- this._innerParse(text);
- }
-
- /**
- * @param {string} text
- * @return {!Promise<!Array.<!Common.FormatterWorkerPool.CSSRule>>}
- */
- parsePromise(text) {
- return new Promise(promiseConstructor.bind(this));
-
- /**
- * @param {function()} succ
- * @param {function()} fail
- * @this {SDK.CSSParser}
- */
- function promiseConstructor(succ, fail) {
- this.parse(text, succ);
- }
- }
-
- dispose() {
- if (this._terminated)
- return;
- this._terminated = true;
- this._runFinishedCallback([]);
- }
-
- /**
- * @return {!Array.<!Common.FormatterWorkerPool.CSSRule>}
- */
- rules() {
- return this._rules;
- }
-
- _lock() {
- console.assert(!this._parsingStyleSheet, 'Received request to parse stylesheet before previous was completed.');
- this._parsingStyleSheet = true;
- }
-
- _unlock() {
- delete this._parsingStyleSheet;
- }
-
- /**
- * @param {?string} text
- */
- _innerParse(text) {
- this._rules = [];
- Common.formatterWorkerPool.parseCSS(text || '', this._onRuleChunk.bind(this));
- }
-
- /**
- * @param {boolean} isLastChunk
- * @param {!Array.<!Common.FormatterWorkerPool.CSSRule>} rules
- */
- _onRuleChunk(isLastChunk, rules) {
- if (this._terminated)
- return;
- this._rules = this._rules.concat(rules);
- if (isLastChunk)
- this._onFinishedParsing();
- this.dispatchEventToListeners(SDK.CSSParser.Events.RulesParsed);
- }
-
- _onFinishedParsing() {
- this._unlock();
- this._runFinishedCallback(this._rules);
- }
-
- /**
- * @param {!Array<!SDK.CSSRule>} rules
- */
- _runFinishedCallback(rules) {
- var callback = this._finishedCallback;
- delete this._finishedCallback;
- if (callback)
- callback.call(null, rules);
- }
-};
-
-/** @enum {symbol} */
-SDK.CSSParser.Events = {
- RulesParsed: Symbol('RulesParsed')
-};

Powered by Google App Engine
This is Rietveld 408576698