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

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

Issue 1937033002: Fix crash in CSSStyleSheetResource::appendData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move CSSPreloaderResourceClient to the Oilpan heap, make it a ResourceOwner Created 4 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory 98 // Don't cache the decoded text, regenerating is cheap and it can use quite a bit of memory
99 return decodedText(); 99 return decodedText();
100 } 100 }
101 101
102 void CSSStyleSheetResource::appendData(const char* data, size_t length) 102 void CSSStyleSheetResource::appendData(const char* data, size_t length)
103 { 103 {
104 Resource::appendData(data, length); 104 Resource::appendData(data, length);
105 if (m_didNotifyFirstData) 105 if (m_didNotifyFirstData)
106 return; 106 return;
107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 107 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
108 while (StyleSheetResourceClient* c = w.next()) 108 while (StyleSheetResourceClient* c = w.next()) {
109 ASSERT(m_data);
109 c->didAppendFirstData(this); 110 c->didAppendFirstData(this);
111 }
110 m_didNotifyFirstData = true; 112 m_didNotifyFirstData = true;
111 } 113 }
112 114
113 void CSSStyleSheetResource::checkNotify() 115 void CSSStyleSheetResource::checkNotify()
114 { 116 {
115 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify() 117 // Decode the data to find out the encoding and keep the sheet text around d uring checkNotify()
116 if (m_data) 118 if (m_data)
117 m_decodedSheetText = decodedText(); 119 m_decodedSheetText = decodedText();
118 120
119 ResourceClientWalker<StyleSheetResourceClient> w(m_clients); 121 ResourceClientWalker<StyleSheetResourceClient> w(m_clients);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes()); 192 setDecodedSize(m_parsedStyleSheetCache->estimatedSizeInBytes());
191 193
192 // Check if this stylesheet resource didn't conflict with 194 // Check if this stylesheet resource didn't conflict with
193 // another resource and has indeed been added to the cache. 195 // another resource and has indeed been added to the cache.
194 if (memoryCache()->contains(this)) 196 if (memoryCache()->contains(this))
195 m_parsedStyleSheetCache->addedToMemoryCache(); 197 m_parsedStyleSheetCache->addedToMemoryCache();
196 } 198 }
197 199
198 } // namespace blink 200 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698