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

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: Renamed according to comments. Created 6 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 m_decodedSheetText = m_decodedSheetText + m_decoder->flush(); 101 m_decodedSheetText = m_decodedSheetText + m_decoder->flush();
102 } 102 }
103 103
104 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 104 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
105 while (StyleSheetResourceClient* c = w.next()) 105 while (StyleSheetResourceClient* c = w.next())
106 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder ->encoding().name(), this); 106 c->setCSSStyleSheet(m_resourceRequest.url(), m_response.url(), m_decoder ->encoding().name(), this);
107 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate. 107 // Clear the decoded text as it is unlikely to be needed immediately again a nd is cheap to regenerate.
108 m_decodedSheetText = String(); 108 m_decodedSheetText = String();
109 } 109 }
110 110
111 void CSSStyleSheetResource::appendData(const char* data, int length)
112 {
113 Resource::appendData(data, length);
114
115 ResourcePtr<CSSStyleSheetResource> protect(this);
116 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
117 while (StyleSheetResourceClient* c = w.next())
abarth-chromium 2014/06/26 16:37:59 Please use complete words as variable names. w ->
118 c->dataReceived(this, data, length);
119 }
120
111 bool CSSStyleSheetResource::isSafeToUnlock() const 121 bool CSSStyleSheetResource::isSafeToUnlock() const
112 { 122 {
113 return m_data->hasOneRef(); 123 return m_data->hasOneRef();
114 } 124 }
115 125
116 void CSSStyleSheetResource::destroyDecodedDataIfPossible() 126 void CSSStyleSheetResource::destroyDecodedDataIfPossible()
117 { 127 {
118 if (!m_parsedStyleSheetCache) 128 if (!m_parsedStyleSheetCache)
119 return; 129 return;
120 130
(...skipping 55 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

Powered by Google App Engine
This is Rietveld 408576698