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

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

Issue 1989093003: Remove the prefinalizer of Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp1985033003
Patch Set: Created 4 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 * (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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return size; 55 return size;
56 } 56 }
57 57
58 StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context) 58 StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String& originalURL, const CSSParserContext& context)
59 : m_ownerRule(ownerRule) 59 : m_ownerRule(ownerRule)
60 , m_originalURL(originalURL) 60 , m_originalURL(originalURL)
61 , m_defaultNamespace(starAtom) 61 , m_defaultNamespace(starAtom)
62 , m_hasSyntacticallyValidCSSHeader(true) 62 , m_hasSyntacticallyValidCSSHeader(true)
63 , m_didLoadErrorOccur(false) 63 , m_didLoadErrorOccur(false)
64 , m_isMutable(false) 64 , m_isMutable(false)
65 , m_isReferencedFromResource(false)
66 , m_hasFontFaceRule(false) 65 , m_hasFontFaceRule(false)
67 , m_hasMediaQueries(false) 66 , m_hasMediaQueries(false)
68 , m_hasSingleOwnerDocument(true) 67 , m_hasSingleOwnerDocument(true)
69 , m_parserContext(context) 68 , m_parserContext(context)
70 { 69 {
71 } 70 }
72 71
73 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) 72 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o)
74 : m_ownerRule(nullptr) 73 : m_ownerRule(nullptr)
75 , m_originalURL(o.m_originalURL) 74 , m_originalURL(o.m_originalURL)
76 , m_importRules(o.m_importRules.size()) 75 , m_importRules(o.m_importRules.size())
77 , m_namespaceRules(o.m_namespaceRules.size()) 76 , m_namespaceRules(o.m_namespaceRules.size())
78 , m_childRules(o.m_childRules.size()) 77 , m_childRules(o.m_childRules.size())
79 , m_namespaces(o.m_namespaces) 78 , m_namespaces(o.m_namespaces)
80 , m_defaultNamespace(o.m_defaultNamespace) 79 , m_defaultNamespace(o.m_defaultNamespace)
81 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader) 80 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader)
82 , m_didLoadErrorOccur(false) 81 , m_didLoadErrorOccur(false)
83 , m_isMutable(false) 82 , m_isMutable(false)
84 , m_isReferencedFromResource(false)
85 , m_hasFontFaceRule(o.m_hasFontFaceRule) 83 , m_hasFontFaceRule(o.m_hasFontFaceRule)
86 , m_hasMediaQueries(o.m_hasMediaQueries) 84 , m_hasMediaQueries(o.m_hasMediaQueries)
87 , m_hasSingleOwnerDocument(true) 85 , m_hasSingleOwnerDocument(true)
88 , m_parserContext(o.m_parserContext) 86 , m_parserContext(o.m_parserContext)
89 { 87 {
90 // FIXME: Copy import rules. 88 // FIXME: Copy import rules.
91 ASSERT(o.m_importRules.isEmpty()); 89 ASSERT(o.m_importRules.isEmpty());
92 90
93 for (unsigned i = 0; i < m_childRules.size(); ++i) 91 for (unsigned i = 0; i < m_childRules.size(); ++i)
94 m_childRules[i] = o.m_childRules[i]->copy(); 92 m_childRules[i] = o.m_childRules[i]->copy();
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 m_completedClients.remove(sheet); 577 m_completedClients.remove(sheet);
580 m_loadingClients.add(sheet); 578 m_loadingClients.add(sheet);
581 } 579 }
582 580
583 void StyleSheetContents::removeSheetFromCache(Document* document) 581 void StyleSheetContents::removeSheetFromCache(Document* document)
584 { 582 {
585 ASSERT(document); 583 ASSERT(document);
586 document->styleEngine().removeSheet(this); 584 document->styleEngine().removeSheet(this);
587 } 585 }
588 586
589 void StyleSheetContents::setReferencedFromResource(bool referenced) 587 void StyleSheetContents::setReferencedFromResource(CSSStyleSheetResource* resour ce)
590 { 588 {
591 ASSERT(referenced != m_isReferencedFromResource); 589 DCHECK(resource);
592 ASSERT(isCacheableForResource()); 590 DCHECK(!isReferencedFromResource());
593 m_isReferencedFromResource = referenced; 591 DCHECK(isCacheableForResource());
592 m_referencedFromResource = resource;
593 }
594
595 void StyleSheetContents::clearReferencedFromResource()
596 {
597 DCHECK(isReferencedFromResource());
598 DCHECK(isCacheableForResource());
599 m_referencedFromResource = nullptr;
594 } 600 }
595 601
596 RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium, Ad dRuleFlags addRuleFlags) 602 RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium, Ad dRuleFlags addRuleFlags)
597 { 603 {
598 if (!m_ruleSet) { 604 if (!m_ruleSet) {
599 m_ruleSet = RuleSet::create(); 605 m_ruleSet = RuleSet::create();
600 m_ruleSet->addRulesFromSheet(this, medium, addRuleFlags); 606 m_ruleSet->addRulesFromSheet(this, medium, addRuleFlags);
601 } 607 }
602 return *m_ruleSet.get(); 608 return *m_ruleSet.get();
603 } 609 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 678
673 DEFINE_TRACE(StyleSheetContents) 679 DEFINE_TRACE(StyleSheetContents)
674 { 680 {
675 visitor->trace(m_ownerRule); 681 visitor->trace(m_ownerRule);
676 visitor->trace(m_importRules); 682 visitor->trace(m_importRules);
677 visitor->trace(m_namespaceRules); 683 visitor->trace(m_namespaceRules);
678 visitor->trace(m_childRules); 684 visitor->trace(m_childRules);
679 visitor->trace(m_loadingClients); 685 visitor->trace(m_loadingClients);
680 visitor->trace(m_completedClients); 686 visitor->trace(m_completedClients);
681 visitor->trace(m_ruleSet); 687 visitor->trace(m_ruleSet);
688 visitor->trace(m_referencedFromResource);
682 } 689 }
683 690
684 } // namespace blink 691 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698