diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
commit | 635860845790a19bf50bbc51ba8fb66a96dde068 (patch) | |
tree | ef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/loader/FTPDirectoryDocument.cpp | |
parent | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff) | |
download | external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2 |
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/loader/FTPDirectoryDocument.cpp')
-rw-r--r-- | WebCore/loader/FTPDirectoryDocument.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index 0a7e91e..08ef896 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -38,6 +38,7 @@ #include "Settings.h" #include "SharedBuffer.h" #include "Text.h" +#include <wtf/StdLibExtras.h> #if PLATFORM(QT) #include <QDateTime> @@ -323,20 +324,22 @@ void FTPDirectoryTokenizer::parseAndAppendOneLine(const String& inputLine) appendEntry(filename, processFilesizeString(result.fileSize, result.type == FTPDirectoryEntry), processFileDateString(result.modifiedTime), result.type == FTPDirectoryEntry); } +static inline PassRefPtr<SharedBuffer> createTemplateDocumentData(Settings* settings) +{ + RefPtr<SharedBuffer> buffer = 0; + if (settings) + buffer = SharedBuffer::createWithContentsOfFile(settings->ftpDirectoryTemplatePath()); + if (buffer) + LOG(FTP, "Loaded FTPDirectoryTemplate of length %i\n", buffer->size()); + return buffer.release(); +} + bool FTPDirectoryTokenizer::loadDocumentTemplate() { - static RefPtr<SharedBuffer> templateDocumentData; + DEFINE_STATIC_LOCAL(RefPtr<SharedBuffer>, templateDocumentData, (createTemplateDocumentData(m_doc->settings()))); // FIXME: Instead of storing the data, we'd rather actually parse the template data into the template Document once, // store that document, then "copy" it whenever we get an FTP directory listing. There are complexities with this // approach that make it worth putting this off. - - if (!templateDocumentData) { - Settings* settings = m_doc->settings(); - if (settings) - templateDocumentData = SharedBuffer::createWithContentsOfFile(settings->ftpDirectoryTemplatePath()); - if (templateDocumentData) - LOG(FTP, "Loaded FTPDirectoryTemplate of length %i\n", templateDocumentData->size()); - } if (!templateDocumentData) { LOG_ERROR("Could not load templateData"); @@ -396,7 +399,7 @@ void FTPDirectoryTokenizer::createBasicDocument() bodyElement->appendChild(m_tableElement, ec); } -bool FTPDirectoryTokenizer::write(const SegmentedString& s, bool appendData) +bool FTPDirectoryTokenizer::write(const SegmentedString& s, bool /*appendData*/) { // Make sure we have the table element to append to by loading the template set in the pref, or // creating a very basic document with the appropriate table |