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

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

Issue 166633002: Prefetch @import files from CSS files. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed according to comments. Created 6 years, 4 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (m_data) 92 if (m_data)
93 m_decodedSheetText = decodedText(); 93 m_decodedSheetText = decodedText();
94 94
95 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 95 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
96 while (StyleSheetResourceClient* c = w.next()) 96 while (StyleSheetResourceClient* c = w.next())
97 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); 97 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this);
98 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. 98 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate.
99 m_decodedSheetText = String(); 99 m_decodedSheetText = String();
100 } 100 }
101 101
102 void CSSStyleSheetResource::appendData(const char* data, int length)
103 {
104 Resource::appendData(data, length);
105
106 ResourcePtr<CSSStyleSheetResource> protect(this);
107 ResourceClientWalker<StyleSheetResourceClient> walker(m_clients);
108 while (StyleSheetResourceClient* client = walker.next())
109 client->dataReceived(this, data, length);
110 }
111
102 bool CSSStyleSheetResource::isSafeToUnlock() const 112 bool CSSStyleSheetResource::isSafeToUnlock() const
103 { 113 {
104 return m_data->hasOneRef(); 114 return m_data->hasOneRef();
105 } 115 }
106 116
107 void CSSStyleSheetResource::destroyDecodedDataIfPossible() 117 void CSSStyleSheetResource::destroyDecodedDataIfPossible()
108 { 118 {
109 if (!m_parsedStyleSheetCache) 119 if (!m_parsedStyleSheetCache)
110 return; 120 return;
111 121
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 177
168 if (m_parsedStyleSheetCache) 178 if (m_parsedStyleSheetCache)
169 m_parsedStyleSheetCache->removedFromMemoryCache(); 179 m_parsedStyleSheetCache->removedFromMemoryCache();
170 m_parsedStyleSheetCache = sheet; 180 m_parsedStyleSheetCache = sheet;
171 m_parsedStyleSheetCache->addedToMemoryCache(); 181 m_parsedStyleSheetCache->addedToMemoryCache();
172 182
173 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 183 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
174 } 184 }
175 185
176 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698