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

Side by Side Diff: Source/WebCore/loader/cache/CachedSVGDocument.cpp

Issue 14210003: Simplify CachedResource::data (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> 2 Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com>
3 Copyright (C) 2011 Cosmin Truta <ctruta@gmail.com> 3 Copyright (C) 2011 Cosmin Truta <ctruta@gmail.com>
4 Copyright (C) 2012 University of Szeged 4 Copyright (C) 2012 University of Szeged
5 Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 5 Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void CachedSVGDocument::setEncoding(const String& chs) 46 void CachedSVGDocument::setEncoding(const String& chs)
47 { 47 {
48 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader); 48 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader);
49 } 49 }
50 50
51 String CachedSVGDocument::encoding() const 51 String CachedSVGDocument::encoding() const
52 { 52 {
53 return m_decoder->encoding().name(); 53 return m_decoder->encoding().name();
54 } 54 }
55 55
56 void CachedSVGDocument::data(PassRefPtr<ResourceBuffer> data, bool allDataReceiv ed) 56 void CachedSVGDocument::checkNotify()
57 { 57 {
58 if (!allDataReceived) 58 if (m_data) {
59 return;
60
61 if (data) {
62 StringBuilder decodedText; 59 StringBuilder decodedText;
63 decodedText.append(m_decoder->decode(data->data(), data->size())); 60 decodedText.append(m_decoder->decode(m_data->data(), m_data->size()));
64 decodedText.append(m_decoder->flush()); 61 decodedText.append(m_decoder->flush());
65 // We don't need to create a new frame because the new document belongs to the parent UseElement. 62 // We don't need to create a new frame because the new document belongs to the parent UseElement.
66 m_document = SVGDocument::create(0, response().url()); 63 m_document = SVGDocument::create(0, response().url());
67 m_document->setContent(decodedText.toString()); 64 m_document->setContent(decodedText.toString());
68 } 65 }
69 66 CachedResource::checkNotify();
70 setLoading(false);
71 checkNotify();
72 } 67 }
73 68
74 void CachedSVGDocument::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co nst 69 void CachedSVGDocument::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co nst
75 { 70 {
76 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceSVG); 71 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceSVG);
77 CachedResource::reportMemoryUsage(memoryObjectInfo); 72 CachedResource::reportMemoryUsage(memoryObjectInfo);
78 info.addMember(m_document, "document"); 73 info.addMember(m_document, "document");
79 info.addMember(m_decoder, "decoder"); 74 info.addMember(m_decoder, "decoder");
80 } 75 }
81 76
82 } 77 }
83 78
84 #endif 79 #endif
85 80
OLDNEW
« no previous file with comments | « Source/WebCore/loader/cache/CachedSVGDocument.h ('k') | Source/WebCore/loader/cache/CachedScript.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698