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

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 Yoav´s comments Created 5 years, 11 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
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | Source/core/fetch/StyleSheetResourceClient.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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (m_data) 102 if (m_data)
103 m_decodedSheetText = decodedText(); 103 m_decodedSheetText = decodedText();
104 104
105 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 105 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
106 while (StyleSheetResourceClient* c = w.next()) 106 while (StyleSheetResourceClient* c = w.next())
107 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this); 107 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), encoding( ), this);
108 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. 108 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate.
109 m_decodedSheetText = String(); 109 m_decodedSheetText = String();
110 } 110 }
111 111
112 void CSSStyleSheetResource::appendData(const char* data, unsigned length)
113 {
114 Resource::appendData(data, length);
115
116 ResourcePtr<CSSStyleSheetResource> protect(this);
117 ResourceClientWalker<StyleSheetResourceClient> walker(m_clients);
118 while (StyleSheetResourceClient* client = walker.next())
119 client->dataReceived(this);
120 }
121
112 bool CSSStyleSheetResource::isSafeToUnlock() const 122 bool CSSStyleSheetResource::isSafeToUnlock() const
113 { 123 {
114 return m_data->hasOneRef(); 124 return m_data->hasOneRef();
115 } 125 }
116 126
117 void CSSStyleSheetResource::destroyDecodedDataIfPossible() 127 void CSSStyleSheetResource::destroyDecodedDataIfPossible()
118 { 128 {
119 if (!m_parsedStyleSheetCache) 129 if (!m_parsedStyleSheetCache)
120 return; 130 return;
121 131
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 186
177 if (m_parsedStyleSheetCache) 187 if (m_parsedStyleSheetCache)
178 m_parsedStyleSheetCache->removedFromMemoryCache(); 188 m_parsedStyleSheetCache->removedFromMemoryCache();
179 m_parsedStyleSheetCache = sheet; 189 m_parsedStyleSheetCache = sheet;
180 m_parsedStyleSheetCache->addedToMemoryCache(); 190 m_parsedStyleSheetCache->addedToMemoryCache();
181 191
182 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 192 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
183 } 193 }
184 194
185 } 195 }
OLDNEW
« no previous file with comments | « Source/core/fetch/CSSStyleSheetResource.h ('k') | Source/core/fetch/StyleSheetResourceClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698