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

Side by Side Diff: Source/core/fetch/CSSStyleSheetResource.cpp

Issue 389553002: Refactoring: Make ~CSSStyleSheetResource empty. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add an assertion Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | Source/core/fetch/Resource.h » ('j') | 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 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 6 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 { 42 {
43 DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", At omicString::ConstructFromLiteral)); 43 DEFINE_STATIC_LOCAL(const AtomicString, acceptCSS, ("text/css,*/*;q=0.1", At omicString::ConstructFromLiteral));
44 44
45 // Prefer text/css but accept any type (dell.com serves a stylesheet 45 // Prefer text/css but accept any type (dell.com serves a stylesheet
46 // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>). 46 // as text/html; see <http://bugs.webkit.org/show_bug.cgi?id=11451>).
47 setAccept(acceptCSS); 47 setAccept(acceptCSS);
48 } 48 }
49 49
50 CSSStyleSheetResource::~CSSStyleSheetResource() 50 CSSStyleSheetResource::~CSSStyleSheetResource()
51 { 51 {
52 // Make sure dispose() was cllaed before destruction.
53 ASSERT(!m_parsedStyleSheetCache);
54 }
55
56 void CSSStyleSheetResource::dispose()
57 {
52 if (m_parsedStyleSheetCache) 58 if (m_parsedStyleSheetCache)
53 m_parsedStyleSheetCache->removedFromMemoryCache(); 59 m_parsedStyleSheetCache->removedFromMemoryCache();
60 m_parsedStyleSheetCache.clear();
54 } 61 }
55 62
56 void CSSStyleSheetResource::didAddClient(ResourceClient* c) 63 void CSSStyleSheetResource::didAddClient(ResourceClient* c)
57 { 64 {
58 ASSERT(c->resourceClientType() == StyleSheetResourceClient::expectedType()); 65 ASSERT(c->resourceClientType() == StyleSheetResourceClient::expectedType());
59 // Resource::didAddClient() must be before setCSSStyleSheet(), 66 // Resource::didAddClient() must be before setCSSStyleSheet(),
60 // because setCSSStyleSheet() may cause scripts to be executed, which could destroy 'c' if it is an instance of HTMLLinkElement. 67 // because setCSSStyleSheet() may cause scripts to be executed, which could destroy 'c' if it is an instance of HTMLLinkElement.
61 // see the comment of HTMLLinkElement::setCSSStyleSheet. 68 // see the comment of HTMLLinkElement::setCSSStyleSheet.
62 Resource::didAddClient(c); 69 Resource::didAddClient(c);
63 70
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 167
161 if (m_parsedStyleSheetCache) 168 if (m_parsedStyleSheetCache)
162 m_parsedStyleSheetCache->removedFromMemoryCache(); 169 m_parsedStyleSheetCache->removedFromMemoryCache();
163 m_parsedStyleSheetCache = sheet; 170 m_parsedStyleSheetCache = sheet;
164 m_parsedStyleSheetCache->addedToMemoryCache(); 171 m_parsedStyleSheetCache->addedToMemoryCache();
165 172
166 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 173 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
167 } 174 }
168 175
169 } 176 }
OLDNEW
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698