Changeset 85974 in webkit


Ignore:
Timestamp:
May 6, 2011 1:52:53 PM (13 years ago)
Author:
brettw@chromium.org
Message:

2011-05-06 Brett Wilson <brettw@chromium.org>

Reviewed by Adam Barth.

Use a File object to store the downloaded file reference rather than
just the path. This keeps the file and permissions in scope (using the
already-existing blob system) so the browser won't delete the file
when the load is complete. Instead, the file will be cleaned up when
the request objects are deleted.
https://bugs.webkit.org/show_bug.cgi?id=60281

  • platform/network/chromium/ResourceResponse.cpp: (WebCore::ResourceResponse::doPlatformCopyData): (WebCore::ResourceResponse::doPlatformAdopt):
  • platform/network/chromium/ResourceResponse.h: (WebCore::ResourceResponse::downloadedFile): (WebCore::ResourceResponse::setDownloadedFile):
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85973 r85974  
     12011-05-06  Brett Wilson  <brettw@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Use a File object to store the downloaded file reference rather than
     6        just the path. This keeps the file and permissions in scope (using the
     7        already-existing blob system) so the browser won't delete the file
     8        when the load is complete. Instead, the file will be cleaned up when
     9        the request objects are deleted.
     10        https://bugs.webkit.org/show_bug.cgi?id=60281
     11
     12        * platform/network/chromium/ResourceResponse.cpp:
     13        (WebCore::ResourceResponse::doPlatformCopyData):
     14        (WebCore::ResourceResponse::doPlatformAdopt):
     15        * platform/network/chromium/ResourceResponse.h:
     16        (WebCore::ResourceResponse::downloadedFile):
     17        (WebCore::ResourceResponse::setDownloadedFile):
     18
    1192011-05-06  Alexis Menard  <alexis.menard@openbossa.org>
    220
  • trunk/Source/WebCore/platform/network/chromium/ResourceResponse.cpp

    r80361 r85974  
    4141    data->m_remoteIPAddress = m_remoteIPAddress;
    4242    data->m_remotePort = m_remotePort;
    43     data->m_downloadFilePath = m_downloadFilePath;
     43    // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support m_downloadedFile.
     44    ASSERT(!m_downloadedFile);
    4445    return data;
    4546}
     
    5758    m_remoteIPAddress = data->m_remoteIPAddress;
    5859    m_remotePort = data->m_remotePort;
    59     m_downloadFilePath = data->m_downloadFilePath;
     60    // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support m_downloadedFile.
    6061}
    6162
  • trunk/Source/WebCore/platform/network/chromium/ResourceResponse.h

    r80361 r85974  
    2828#define ResourceResponse_h
    2929
     30#include "File.h"
    3031#include "NotImplemented.h"
    3132#include "ResourceResponseBase.h"
     
    100101        void setRemotePort(unsigned short value) { m_remotePort = value; }
    101102
    102         const String& downloadFilePath() const { return m_downloadFilePath; }
    103         void setDownloadFilePath(const String& downloadFilePath) { m_downloadFilePath = downloadFilePath; }
     103        const File* downloadedFile() const { return m_downloadedFile.get(); }
     104        void setDownloadedFile(PassRefPtr<File> downloadedFile) { m_downloadedFile = downloadedFile; }
    104105
    105106    private:
     
    153154        unsigned short m_remotePort;
    154155
    155         // The path to the downloaded file.
    156         String m_downloadFilePath;
     156        // The downloaded file if the load streamed to a file.
     157        RefPtr<File> m_downloadedFile;
    157158    };
    158159
  • trunk/Source/WebKit/chromium/ChangeLog

    r85966 r85974  
     12011-05-06  Brett Wilson  <brettw@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Use a File object to store the downloaded file reference rather than
     6        just the path. This keeps the file and permissions in scope (using the
     7        already-existing blob system) so the browser won't delete the file
     8        when the load is complete. Instead, the file will be cleaned up when
     9        the request objects are deleted.
     10        https://bugs.webkit.org/show_bug.cgi?id=60281
     11
     12        * src/WebURLResponse.cpp:
     13        (WebKit::WebURLResponse::downloadFilePath):
     14        (WebKit::WebURLResponse::setDownloadFilePath):
     15
    1162011-05-06  John Abd-El-Malek  <jam@chromium.org>
    217
  • trunk/Source/WebKit/chromium/src/WebURLResponse.cpp

    r80361 r85974  
    366366WebString WebURLResponse::downloadFilePath() const
    367367{
    368     return m_private->m_resourceResponse->downloadFilePath();
     368    const File* downloadedFile = m_private->m_resourceResponse->downloadedFile();
     369    if (downloadedFile)
     370        return downloadedFile->path();
     371    return WebString();
    369372}
    370373
    371374void WebURLResponse::setDownloadFilePath(const WebString& downloadFilePath)
    372375{
    373     m_private->m_resourceResponse->setDownloadFilePath(downloadFilePath.utf8().data());
     376    m_private->m_resourceResponse->setDownloadedFile(File::create(downloadFilePath));
    374377}
    375378
Note: See TracChangeset for help on using the changeset viewer.