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

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

Issue 1947053002: Manual revert of "Preload scan external css for @import" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep histograms.xml 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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return toCSSStyleSheetResource(fetcher->requestResource(request, CSSStyleShe etResourceFactory())); 44 return toCSSStyleSheetResource(fetcher->requestResource(request, CSSStyleShe etResourceFactory()));
45 } 45 }
46 46
47 CSSStyleSheetResource* CSSStyleSheetResource::createForTest(const ResourceReques t& request, const String& charset) 47 CSSStyleSheetResource* CSSStyleSheetResource::createForTest(const ResourceReques t& request, const String& charset)
48 { 48 {
49 return new CSSStyleSheetResource(request, ResourceLoaderOptions(), charset); 49 return new CSSStyleSheetResource(request, ResourceLoaderOptions(), charset);
50 } 50 }
51 51
52 CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequ est, const ResourceLoaderOptions& options, const String& charset) 52 CSSStyleSheetResource::CSSStyleSheetResource(const ResourceRequest& resourceRequ est, const ResourceLoaderOptions& options, const String& charset)
53 : StyleSheetResource(resourceRequest, CSSStyleSheet, options, "text/css", ch arset) 53 : StyleSheetResource(resourceRequest, CSSStyleSheet, options, "text/css", ch arset)
54 , m_didNotifyFirstData(false)
55 { 54 {
56 } 55 }
57 56
58 CSSStyleSheetResource::~CSSStyleSheetResource() 57 CSSStyleSheetResource::~CSSStyleSheetResource()
59 { 58 {
60 } 59 }
61 60
62 void CSSStyleSheetResource::removedFromMemoryCache() 61 void CSSStyleSheetResource::removedFromMemoryCache()
63 { 62 {
64 if (m_parsedStyleSheetCache) 63 if (m_parsedStyleSheetCache)
(...skipping 27 matching lines...) Expand all
92 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck)) 91 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck))
93 return String(); 92 return String();
94 93
95 if (!m_decodedSheetText.isNull()) 94 if (!m_decodedSheetText.isNull())
96 return m_decodedSheetText; 95 return m_decodedSheetText;
97 96
98 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory 97 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory
99 return decodedText(); 98 return decodedText();
100 } 99 }
101 100
102 void CSSStyleSheetResource::appendData(const char* data, size_t length)
103 {
104 Resource::appendData(data, length);
105 if (m_didNotifyFirstData)
106 return;
107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
108 while (StyleSheetResourceClient* c = w.next())
109 c->didAppendFirstData(this);
110 m_didNotifyFirstData = true;
111 }
112
113 void CSSStyleSheetResource::checkNotify() 101 void CSSStyleSheetResource::checkNotify()
114 { 102 {
115 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() 103 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify()
116 if (m_data) 104 if (m_data)
117 m_decodedSheetText = decodedText(); 105 m_decodedSheetText = decodedText();
118 106
119 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
120 while (StyleSheetResourceClient* c = w.next()) 108 while (StyleSheetResourceClient* c = w.next())
121 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); 109 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this);
122 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. 110 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 177
190 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 178 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
191 179
192 // Check if this stylesheet resource didn't conflict with 180 // Check if this stylesheet resource didn't conflict with
193 // another resource and has indeed been added to the cache. 181 // another resource and has indeed been added to the cache.
194 if (memoryCache()->contains(this)) 182 if (memoryCache()->contains(this))
195 m_parsedStyleSheetCache->addedToMemoryCache(); 183 m_parsedStyleSheetCache->addedToMemoryCache();
196 } 184 }
197 185
198 } // namespace blink 186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698