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

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

Issue 1996293002: Make ImportedStyleSheetClient GarbageCollected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleRuleImport.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 20 matching lines...) Expand all
31 namespace blink { 31 namespace blink {
32 32
33 StyleRuleImport* StyleRuleImport::create(const String& href, MediaQuerySet* medi a) 33 StyleRuleImport* StyleRuleImport::create(const String& href, MediaQuerySet* medi a)
34 { 34 {
35 return new StyleRuleImport(href, media); 35 return new StyleRuleImport(href, media);
36 } 36 }
37 37
38 StyleRuleImport::StyleRuleImport(const String& href, MediaQuerySet* media) 38 StyleRuleImport::StyleRuleImport(const String& href, MediaQuerySet* media)
39 : StyleRuleBase(Import) 39 : StyleRuleBase(Import)
40 , m_parentStyleSheet(nullptr) 40 , m_parentStyleSheet(nullptr)
41 , m_styleSheetClient(this) 41 , m_styleSheetClient(new ImportedStyleSheetClient(this))
42 , m_strHref(href) 42 , m_strHref(href)
43 , m_mediaQueries(media) 43 , m_mediaQueries(media)
44 , m_loading(false) 44 , m_loading(false)
45 { 45 {
46 if (!m_mediaQueries) 46 if (!m_mediaQueries)
47 m_mediaQueries = MediaQuerySet::create(String()); 47 m_mediaQueries = MediaQuerySet::create(String());
48 48
49 ThreadState::current()->registerPreFinalizer(this); 49 ThreadState::current()->registerPreFinalizer(this);
50 } 50 }
51 51
52 StyleRuleImport::~StyleRuleImport() 52 StyleRuleImport::~StyleRuleImport()
53 { 53 {
54 } 54 }
55 55
56 void StyleRuleImport::dispose() 56 void StyleRuleImport::dispose()
57 { 57 {
58 if (m_resource) 58 if (m_resource)
59 m_resource->removeClient(&m_styleSheetClient); 59 m_resource->removeClient(m_styleSheetClient);
haraken 2016/05/20 09:21:10 Can you move this to a pre-finalizer of ImportedSt
yhirano 2016/05/23 11:29:05 In this case StyleRuleImport has the resource and
60 m_resource = nullptr; 60 m_resource = nullptr;
61 } 61 }
62 62
63 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport) 63 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport)
64 { 64 {
65 visitor->trace(m_styleSheetClient); 65 visitor->trace(m_styleSheetClient);
66 visitor->trace(m_parentStyleSheet); 66 visitor->trace(m_parentStyleSheet);
67 visitor->trace(m_mediaQueries); 67 visitor->trace(m_mediaQueries);
68 visitor->trace(m_styleSheet); 68 visitor->trace(m_styleSheet);
69 visitor->trace(m_resource); 69 visitor->trace(m_resource);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 FetchRequest request(ResourceRequest(absURL), FetchInitiatorTypeNames::css, m_parentStyleSheet->charset()); 134 FetchRequest request(ResourceRequest(absURL), FetchInitiatorTypeNames::css, m_parentStyleSheet->charset());
135 m_resource = CSSStyleSheetResource::fetch(request, fetcher); 135 m_resource = CSSStyleSheetResource::fetch(request, fetcher);
136 if (m_resource) { 136 if (m_resource) {
137 // if the import rule is issued dynamically, the sheet may be 137 // if the import rule is issued dynamically, the sheet may be
138 // removed from the pending sheet count, so let the doc know 138 // removed from the pending sheet count, so let the doc know
139 // the sheet being imported is pending. 139 // the sheet being imported is pending.
140 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootShe et == m_parentStyleSheet) 140 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootShe et == m_parentStyleSheet)
141 m_parentStyleSheet->startLoadingDynamicSheet(); 141 m_parentStyleSheet->startLoadingDynamicSheet();
142 m_loading = true; 142 m_loading = true;
143 m_resource->addClient(&m_styleSheetClient); 143 m_resource->addClient(m_styleSheetClient);
144 } 144 }
145 } 145 }
146 146
147 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleRuleImport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698