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

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

Issue 1807323002: [WeakMemoryCache 1a] Make Reference from Inspector to Resource weak, remove removedFromMemoryCache() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove some comments 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_isInMemoryCache(false) 65 , m_isReferencedFromResource(false)
66 , m_hasFontFaceRule(false) 66 , m_hasFontFaceRule(false)
67 , m_hasMediaQueries(false) 67 , m_hasMediaQueries(false)
68 , m_hasSingleOwnerDocument(true) 68 , m_hasSingleOwnerDocument(true)
69 , m_parserContext(context) 69 , m_parserContext(context)
70 { 70 {
71 } 71 }
72 72
73 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) 73 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o)
74 : m_ownerRule(nullptr) 74 : m_ownerRule(nullptr)
75 , m_originalURL(o.m_originalURL) 75 , m_originalURL(o.m_originalURL)
76 , m_importRules(o.m_importRules.size()) 76 , m_importRules(o.m_importRules.size())
77 , m_namespaceRules(o.m_namespaceRules.size()) 77 , m_namespaceRules(o.m_namespaceRules.size())
78 , m_childRules(o.m_childRules.size()) 78 , m_childRules(o.m_childRules.size())
79 , m_namespaces(o.m_namespaces) 79 , m_namespaces(o.m_namespaces)
80 , m_defaultNamespace(o.m_defaultNamespace) 80 , m_defaultNamespace(o.m_defaultNamespace)
81 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader) 81 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader)
82 , m_didLoadErrorOccur(false) 82 , m_didLoadErrorOccur(false)
83 , m_isMutable(false) 83 , m_isMutable(false)
84 , m_isInMemoryCache(false) 84 , m_isReferencedFromResource(false)
85 , m_hasFontFaceRule(o.m_hasFontFaceRule) 85 , m_hasFontFaceRule(o.m_hasFontFaceRule)
86 , m_hasMediaQueries(o.m_hasMediaQueries) 86 , m_hasMediaQueries(o.m_hasMediaQueries)
87 , m_hasSingleOwnerDocument(true) 87 , m_hasSingleOwnerDocument(true)
88 , m_parserContext(o.m_parserContext) 88 , m_parserContext(o.m_parserContext)
89 { 89 {
90 ASSERT(o.isCacheable()); 90 ASSERT(o.isCacheable());
91 91
92 // FIXME: Copy import rules. 92 // FIXME: Copy import rules.
93 ASSERT(o.m_importRules.isEmpty()); 93 ASSERT(o.m_importRules.isEmpty());
94 94
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 m_completedClients.remove(sheet); 565 m_completedClients.remove(sheet);
566 m_loadingClients.add(sheet); 566 m_loadingClients.add(sheet);
567 } 567 }
568 568
569 void StyleSheetContents::removeSheetFromCache(Document* document) 569 void StyleSheetContents::removeSheetFromCache(Document* document)
570 { 570 {
571 ASSERT(document); 571 ASSERT(document);
572 document->styleEngine().removeSheet(this); 572 document->styleEngine().removeSheet(this);
573 } 573 }
574 574
575 void StyleSheetContents::addedToMemoryCache() 575 void StyleSheetContents::setReferencedFromResource(bool referenced)
576 { 576 {
577 ASSERT(!m_isInMemoryCache); 577 ASSERT(referenced != m_isReferencedFromResource);
578 ASSERT(isCacheable()); 578 ASSERT(isCacheable());
579 m_isInMemoryCache = true; 579 m_isReferencedFromResource = referenced;
580 }
581
582 void StyleSheetContents::removedFromMemoryCache()
583 {
584 ASSERT(isCacheable());
585 m_isInMemoryCache = false;
586 } 580 }
587 581
588 RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium, Ad dRuleFlags addRuleFlags) 582 RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium, Ad dRuleFlags addRuleFlags)
589 { 583 {
590 if (!m_ruleSet) { 584 if (!m_ruleSet) {
591 m_ruleSet = RuleSet::create(); 585 m_ruleSet = RuleSet::create();
592 m_ruleSet->addRulesFromSheet(this, medium, addRuleFlags); 586 m_ruleSet->addRulesFromSheet(this, medium, addRuleFlags);
593 } 587 }
594 return *m_ruleSet.get(); 588 return *m_ruleSet.get();
595 } 589 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 visitor->trace(m_ownerRule); 661 visitor->trace(m_ownerRule);
668 visitor->trace(m_importRules); 662 visitor->trace(m_importRules);
669 visitor->trace(m_namespaceRules); 663 visitor->trace(m_namespaceRules);
670 visitor->trace(m_childRules); 664 visitor->trace(m_childRules);
671 visitor->trace(m_loadingClients); 665 visitor->trace(m_loadingClients);
672 visitor->trace(m_completedClients); 666 visitor->trace(m_completedClients);
673 visitor->trace(m_ruleSet); 667 visitor->trace(m_ruleSet);
674 } 668 }
675 669
676 } // namespace blink 670 } // 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