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

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

Issue 1819593002: Preload scan external css for @import (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck)) 96 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck))
97 return String(); 97 return String();
98 98
99 if (!m_decodedSheetText.isNull()) 99 if (!m_decodedSheetText.isNull())
100 return m_decodedSheetText; 100 return m_decodedSheetText;
101 101
102 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory 102 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory
103 return decodedText(); 103 return decodedText();
104 } 104 }
105 105
106 void CSSStyleSheetResource::appendData(const char* data, size_t length)
107 {
108 Resource::appendData(data, length);
109 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
110 while (StyleSheetResourceClient* c = w.next())
111 c->didAppendData(this);
112 }
113
106 void CSSStyleSheetResource::checkNotify() 114 void CSSStyleSheetResource::checkNotify()
107 { 115 {
108 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() 116 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify()
109 if (m_data) 117 if (m_data)
110 m_decodedSheetText = decodedText(); 118 m_decodedSheetText = decodedText();
111 119
112 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 120 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
113 while (StyleSheetResourceClient* c = w.next()) 121 while (StyleSheetResourceClient* c = w.next())
114 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); 122 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this);
115 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. 123 // 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
182 190
183 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 191 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
184 192
185 // Check if this stylesheet resource didn't conflict with 193 // Check if this stylesheet resource didn't conflict with
186 // another resource and has indeed been added to the cache. 194 // another resource and has indeed been added to the cache.
187 if (memoryCache()->contains(this)) 195 if (memoryCache()->contains(this))
188 m_parsedStyleSheetCache->addedToMemoryCache(); 196 m_parsedStyleSheetCache->addedToMemoryCache();
189 } 197 }
190 198
191 } // namespace blink 199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698