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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleSheetContents.cpp

Issue 2671173002: Change CSSParserContext to have a Document handle (vs UseCounter). (Closed)
Patch Set: comments 1 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 21 matching lines...) Expand all
32 #include "core/dom/StyleEngine.h" 32 #include "core/dom/StyleEngine.h"
33 #include "core/frame/UseCounter.h" 33 #include "core/frame/UseCounter.h"
34 #include "core/inspector/InspectorTraceEvents.h" 34 #include "core/inspector/InspectorTraceEvents.h"
35 #include "core/loader/resource/CSSStyleSheetResource.h" 35 #include "core/loader/resource/CSSStyleSheetResource.h"
36 #include "platform/Histogram.h" 36 #include "platform/Histogram.h"
37 #include "platform/instrumentation/tracing/TraceEvent.h" 37 #include "platform/instrumentation/tracing/TraceEvent.h"
38 #include "platform/weborigin/SecurityOrigin.h" 38 #include "platform/weborigin/SecurityOrigin.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 // static
43 const Document* StyleSheetContents::singleOwnerDocument(
44 const StyleSheetContents* styleSheetContents) {
45 // FIXME(https://crbug.com/242125): We may want to handle stylesheets that
haraken 2017/02/09 02:01:42 TODO
Bret 2017/02/09 02:08:18 Done.
46 // have multiple owners when this is used for UseCounter.
47 if (styleSheetContents && styleSheetContents->hasSingleOwnerNode())
48 return styleSheetContents->singleOwnerDocument();
49 return nullptr;
50 }
51
42 // Rough size estimate for the memory cache. 52 // Rough size estimate for the memory cache.
43 unsigned StyleSheetContents::estimatedSizeInBytes() const { 53 unsigned StyleSheetContents::estimatedSizeInBytes() const {
44 // Note that this does not take into account size of the strings hanging from 54 // Note that this does not take into account size of the strings hanging from
45 // various objects. The assumption is that nearly all of of them are atomic 55 // various objects. The assumption is that nearly all of of them are atomic
46 // and would exist anyway. 56 // and would exist anyway.
47 unsigned size = sizeof(*this); 57 unsigned size = sizeof(*this);
48 58
49 // FIXME: This ignores the children of media rules. 59 // FIXME: This ignores the children of media rules.
50 // Most rules are StyleRules. 60 // Most rules are StyleRules.
51 size += ruleCount() * StyleRule::averageSizeInBytes(); 61 size += ruleCount() * StyleRule::averageSizeInBytes();
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 visitor->trace(m_namespaceRules); 702 visitor->trace(m_namespaceRules);
693 visitor->trace(m_childRules); 703 visitor->trace(m_childRules);
694 visitor->trace(m_loadingClients); 704 visitor->trace(m_loadingClients);
695 visitor->trace(m_completedClients); 705 visitor->trace(m_completedClients);
696 visitor->trace(m_ruleSet); 706 visitor->trace(m_ruleSet);
697 visitor->trace(m_referencedFromResource); 707 visitor->trace(m_referencedFromResource);
698 visitor->trace(m_parserContext); 708 visitor->trace(m_parserContext);
699 } 709 }
700 710
701 } // namespace blink 711 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/css/parser/CSSAtRuleID.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698