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

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: Add histogram to histograms.xml (trybots previous) 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck)) 91 if (!m_data || m_data->isEmpty() || !canUseSheet(mimeTypeCheck))
92 return String(); 92 return String();
93 93
94 if (!m_decodedSheetText.isNull()) 94 if (!m_decodedSheetText.isNull())
95 return m_decodedSheetText; 95 return m_decodedSheetText;
96 96
97 // 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
98 return decodedText(); 98 return decodedText();
99 } 99 }
100 100
101 void CSSStyleSheetResource::appendData(const char* data, size_t length)
102 {
103 Resource::appendData(data, length);
104 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
105 while (StyleSheetResourceClient* c = w.next())
106 c->didAppendData(this);
kouhei (in TOK) 2016/04/21 06:35:03 I'd prefer if the hook is only called on the first
Charlie Harrison 2016/04/25 15:14:34 Done.
107 }
108
101 void CSSStyleSheetResource::checkNotify() 109 void CSSStyleSheetResource::checkNotify()
102 { 110 {
103 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() 111 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify()
104 if (m_data) 112 if (m_data)
105 m_decodedSheetText = decodedText(); 113 m_decodedSheetText = decodedText();
106 114
107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 115 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
108 while (StyleSheetResourceClient* c = w.next()) 116 while (StyleSheetResourceClient* c = w.next())
109 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); 117 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this);
110 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. 118 // 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
177 185
178 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 186 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
179 187
180 // Check if this stylesheet resource didn't conflict with 188 // Check if this stylesheet resource didn't conflict with
181 // another resource and has indeed been added to the cache. 189 // another resource and has indeed been added to the cache.
182 if (memoryCache()->contains(this)) 190 if (memoryCache()->contains(this))
183 m_parsedStyleSheetCache->addedToMemoryCache(); 191 m_parsedStyleSheetCache->addedToMemoryCache();
184 } 192 }
185 193
186 } // namespace blink 194 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698