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

Unified Diff: third_party/WebKit/Source/core/frame/UseCounter.cpp

Issue 2671173002: Change CSSParserContext to have a Document handle (vs UseCounter). (Closed)
Patch Set: fix trace and import Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/UseCounter.cpp
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.cpp b/third_party/WebKit/Source/core/frame/UseCounter.cpp
index 95de635c0081b1f9ec5c6ca89ca5ed9fa52cc07a..564d3e0c0db5200b39dfd169419d4fb551c830c5 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.cpp
+++ b/third_party/WebKit/Source/core/frame/UseCounter.cpp
@@ -1165,6 +1165,24 @@ void UseCounter::didCommitLoad(KURL url) {
}
}
+// static
+const Document* UseCounter::singleOwnerDocument(
+ const StyleSheetContents* styleSheetContents) {
+ // FIXME: We may want to handle stylesheets that have multiple owners
+ // https://crbug.com/242125
+ if (styleSheetContents && styleSheetContents->hasSingleOwnerNode())
+ return styleSheetContents->singleOwnerDocument();
+ return nullptr;
+}
+
+// static
+const Document* UseCounter::singleOwnerDocument(
+ const CSSStyleSheet* styleSheet) {
+ if (styleSheet)
+ return UseCounter::singleOwnerDocument(styleSheet->contents());
+ return nullptr;
+}
+
void UseCounter::count(const Frame* frame, Feature feature) {
if (!frame)
return;
@@ -1250,26 +1268,6 @@ void UseCounter::count(Feature feature) {
recordMeasurement(feature);
}
-UseCounter* UseCounter::getFrom(const Document* document) {
- if (document && document->frameHost())
- return &document->frameHost()->useCounter();
- return 0;
-}
-
-UseCounter* UseCounter::getFrom(const CSSStyleSheet* sheet) {
- if (sheet)
- return getFrom(sheet->contents());
- return 0;
-}
-
-UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) {
- // FIXME: We may want to handle stylesheets that have multiple owners
- // https://crbug.com/242125
- if (sheetContents && sheetContents->hasSingleOwnerNode())
- return getFrom(sheetContents->singleOwnerDocument());
- return 0;
-}
-
EnumerationHistogram& UseCounter::featuresHistogram() const {
// Every SVGImage has it's own Page instance, and multiple web pages can
// share the usage of a single SVGImage. Ideally perhaps we'd delegate

Powered by Google App Engine
This is Rietveld 408576698