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

Side by Side Diff: Source/WebCore/loader/cache/CachedXSLStyleSheet.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
« no previous file with comments | « Source/WebCore/loader/cache/CachedXSLStyleSheet.h ('k') | no next file » | 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, 2007, 2008 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void CachedXSLStyleSheet::setEncoding(const String& chs) 55 void CachedXSLStyleSheet::setEncoding(const String& chs)
56 { 56 {
57 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader); 57 m_decoder->setEncoding(chs, TextResourceDecoder::EncodingFromHTTPHeader);
58 } 58 }
59 59
60 String CachedXSLStyleSheet::encoding() const 60 String CachedXSLStyleSheet::encoding() const
61 { 61 {
62 return m_decoder->encoding().name(); 62 return m_decoder->encoding().name();
63 } 63 }
64 64
65 void CachedXSLStyleSheet::data(PassRefPtr<ResourceBuffer> data, bool allDataRece ived) 65 void CachedXSLStyleSheet::checkNotify()
66 { 66 {
67 if (!allDataReceived)
68 return;
69
70 m_data = data;
71 setEncodedSize(m_data.get() ? m_data->size() : 0);
72 if (m_data.get()) { 67 if (m_data.get()) {
73 m_sheet = m_decoder->decode(m_data->data(), encodedSize()); 68 m_sheet = m_decoder->decode(m_data->data(), encodedSize());
74 m_sheet.append(m_decoder->flush()); 69 m_sheet.append(m_decoder->flush());
75 } 70 }
76 setLoading(false);
77 checkNotify();
78 }
79
80 void CachedXSLStyleSheet::checkNotify()
81 {
82 if (isLoading())
83 return;
84 71
85 CachedResourceClientWalker<CachedStyleSheetClient> w(m_clients); 72 CachedResourceClientWalker<CachedStyleSheetClient> w(m_clients);
86 while (CachedStyleSheetClient* c = w.next()) 73 while (CachedStyleSheetClient* c = w.next())
87 c->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet); 74 c->setXSLStyleSheet(m_resourceRequest.url(), m_response.url(), m_sheet);
88 } 75 }
89 76
90 void CachedXSLStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 77 void CachedXSLStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
91 { 78 {
92 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceXSLT); 79 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou rceXSLT);
93 CachedResource::reportMemoryUsage(memoryObjectInfo); 80 CachedResource::reportMemoryUsage(memoryObjectInfo);
94 info.addMember(m_sheet, "sheet"); 81 info.addMember(m_sheet, "sheet");
95 info.addMember(m_decoder, "decoder"); 82 info.addMember(m_decoder, "decoder");
96 } 83 }
97 84
98 } // namespace WebCore 85 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/loader/cache/CachedXSLStyleSheet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698