Changeset 69611 in webkit


Ignore:
Timestamp:
Oct 12, 2010 3:16:16 PM (13 years ago)
Author:
jianli@chromium.org
Message:

[chromium] Update WebBlobData to adapt to BlobData change in terms of
handling string data item.
https://bugs.webkit.org/show_bug.cgi?id=47423

Reviewed by Darin Fisher.

Also remove unneeded methods in WebBlobData. WebBlobStorageData.* are
also removed since they're not longer needed.

  • WebKit.gyp:
  • public/WebBlobData.h:
  • public/WebBlobRegistry.h:
  • public/WebBlobStorageData.h: Removed.
  • public/WebThreadSafeData.h: Added.
  • src/WebBlobData.cpp:
  • src/WebBlobStorageData.cpp: Removed.
  • src/WebThreadSafeData.cpp: Added.
Location:
trunk/WebKit/chromium
Files:
1 deleted
5 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r69609 r69611  
     12010-10-12  Jian Li  <jianli@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        [chromium] Update WebBlobData to adapt to BlobData change in terms of
     6        handling string data item.
     7        https://bugs.webkit.org/show_bug.cgi?id=47423
     8
     9        Also remove unneeded methods in WebBlobData. WebBlobStorageData.* are
     10        also removed since they're not longer needed.
     11
     12        * WebKit.gyp:
     13        * public/WebBlobData.h:
     14        * public/WebBlobRegistry.h:
     15        * public/WebBlobStorageData.h: Removed.
     16        * public/WebThreadSafeData.h: Added.
     17        * src/WebBlobData.cpp:
     18        * src/WebBlobStorageData.cpp: Removed.
     19        * src/WebThreadSafeData.cpp: Added.
     20
    1212010-10-12  Kavita Kanetkar  <kkanetkar@chromium.org>
    222
  • trunk/WebKit/chromium/WebKit.gyp

    r69541 r69611  
    113113                'public/WebBlobData.h',
    114114                'public/WebBlobRegistry.h',
    115                 'public/WebBlobStorageData.h',
    116115                'public/WebCache.h',
    117116                'public/WebCanvas.h',
     
    266265                'public/WebTextInputType.h',
    267266                'public/WebTextRun.h',
     267                'public/WebThreadSafeData.h',
    268268                'public/WebURL.h',
    269269                'public/WebURLError.h',
     
    391391                'src/WebBindings.cpp',
    392392                'src/WebBlobData.cpp',
    393                 'src/WebBlobStorageData.cpp',
    394393                'src/WebCache.cpp',
    395394                'src/WebColor.cpp',
     
    524523                'src/WebString.cpp',
    525524                'src/WebTextRun.cpp',
     525                'src/WebThreadSafeData.cpp',
    526526                'src/WebURL.cpp',
    527527                'src/WebURLLoadTiming.cpp',
  • trunk/WebKit/chromium/public/WebBlobData.h

    r65946 r69611  
    3232#define WebBlobData_h
    3333
    34 #include "WebCString.h"
     34#include "WebThreadSafeData.h"
    3535#include "WebString.h"
    3636#include "WebURL.h"
     
    4949    struct Item {
    5050        enum { TypeData, TypeFile, TypeBlob } type;
    51         WebCString data;
     51        WebThreadSafeData data;
    5252        WebString filePath;
    5353        WebURL blobURL;
     
    7373    WEBKIT_API bool itemAt(size_t index, Item& result) const;
    7474
    75     // Appends to the list of items.
    76     WEBKIT_API void appendData(const WebCString&);
    77     WEBKIT_API void appendFile(const WebString& filePath);
    78     WEBKIT_API void appendFile(const WebString& filePath, long long offset, long long length, double expectedModificationTime);
    79     WEBKIT_API void appendBlob(const WebURL& blobURL, long long offset, long long length);
    80 
    8175    WEBKIT_API WebString contentType() const;
    82     WEBKIT_API void setContentType(const WebString&);
    8376
    8477    WEBKIT_API WebString contentDisposition() const;
    85     WEBKIT_API void setContentDisposition(const WebString&);
    8678
    8779#if WEBKIT_IMPLEMENTATION
  • trunk/WebKit/chromium/public/WebBlobRegistry.h

    r65972 r69611  
    3232#define WebBlobRegistry_h
    3333
    34 #include "WebBlobStorageData.h"
    35 
    3634namespace WebKit {
    3735
  • trunk/WebKit/chromium/public/WebThreadSafeData.h

    • Property svn:executable set to *
    r69610 r69611  
    2929 */
    3030
    31 #ifndef WebBlobStorageData_h
    32 #define WebBlobStorageData_h
     31#ifndef WebThreadSafeData_h
     32#define WebThreadSafeData_h
    3333
    34 #include "WebBlobData.h"
    35 #include "WebData.h"
    36 #include "WebFileInfo.h"
    37 #include "WebString.h"
     34#include "WebCommon.h"
     35#include "WebPrivatePtr.h"
    3836
    39 #if WEBKIT_IMPLEMENTATION
    40 namespace WebCore { class BlobStorageData; }
    41 namespace WTF { template <typename T> class PassRefPtr; }
     37#if !WEBKIT_IMPLEMENTATION
     38#include <string>
    4239#endif
     40
     41namespace WebCore { class RawData; }
    4342
    4443namespace WebKit {
    4544
    46 class WebBlobStorageDataPrivate;
     45// A container for raw bytes.  It is inexpensive to copy a WebThreadSafeData object.
     46// It is safe to pass a WebThreadSafeData across threads!!!
     47class WebThreadSafeData {
     48public:
     49    WebThreadSafeData() { }
     50    ~WebThreadSafeData() { reset(); }
    4751
    48 class WebBlobStorageData {
    49 public:
    50     ~WebBlobStorageData() { reset(); }
    51 
    52     WebBlobStorageData() : m_private(0) { }
    53 
     52    WEBKIT_API void assign(const WebThreadSafeData&);
    5453    WEBKIT_API void reset();
    5554
    56     bool isNull() const { return !m_private; }
     55    WEBKIT_API size_t size() const;
     56    WEBKIT_API const char* data() const;
    5757
    58     // Returns the number of items.
    59     WEBKIT_API size_t itemCount() const;
    60 
    61     // Retrieves the values of the item at the given index. Returns false if
    62     // index is out of bounds.
    63     WEBKIT_API bool itemAt(size_t index, WebBlobData::Item& result) const;
    64 
    65     WEBKIT_API WebString contentType() const;
    66     WEBKIT_API WebString contentDisposition() const;
     58    bool isEmpty() const { return !size(); }
    6759
    6860#if WEBKIT_IMPLEMENTATION
    69     WebBlobStorageData(const WTF::PassRefPtr<WebCore::BlobStorageData>&);
    70     WebBlobStorageData& operator=(const WTF::PassRefPtr<WebCore::BlobStorageData>&);
    71     operator WTF::PassRefPtr<WebCore::BlobStorageData>() const;
     61    WebThreadSafeData(const WTF::PassRefPtr<WebCore::RawData>&);
     62    WebThreadSafeData& operator=(const WTF::PassRefPtr<WebCore::RawData>&);
     63#else
     64    operator std::string() const
     65    {
     66        size_t len = size();
     67        return len ? std::string(data(), len) : std::string();
     68    }
    7269#endif
    7370
    7471private:
    75 #if WEBKIT_IMPLEMENTATION
    76     void assign(const WTF::PassRefPtr<WebCore::BlobStorageData>&);
    77 #endif
    78     WebBlobStorageDataPrivate* m_private;
     72    WebPrivatePtr<WebCore::RawData> m_private;
    7973};
    8074
    8175} // namespace WebKit
    8276
    83 #endif // WebBlobStorageData_h
     77#endif
  • trunk/WebKit/chromium/src/WebBlobData.cpp

    r65946 r69611  
    3333
    3434#include "BlobData.h"
     35#include <wtf/PassOwnPtr.h>
    3536
    3637using namespace WebCore;
     
    9091}
    9192
    92 void WebBlobData::appendData(const WebCString& data)
    93 {
    94     ASSERT(!isNull());
    95     m_private->appendData(data);
    96 }
    97 
    98 void WebBlobData::appendFile(const WebString& filePath)
    99 {
    100     ASSERT(!isNull());
    101     m_private->appendFile(filePath);
    102 }
    103 
    104 void WebBlobData::appendFile(const WebString& filePath, long long offset, long long length, double expectedModificationTime)
    105 {
    106     ASSERT(!isNull());
    107     m_private->appendFile(filePath, offset, length, expectedModificationTime);
    108 }
    109 
    110 void WebBlobData::appendBlob(const WebURL& blobURL, long long offset, long long length)
    111 {
    112     ASSERT(!isNull());
    113     m_private->appendBlob(blobURL, offset, length);
    114 }
    115 
    11693WebString WebBlobData::contentType() const
    11794{
     
    12097}
    12198
    122 void WebBlobData::setContentType(const WebString& contentType)
    123 {
    124     ASSERT(!isNull());
    125     m_private->setContentType(contentType);
    126 }
    127 
    12899WebString WebBlobData::contentDisposition() const
    129100{
    130101    ASSERT(!isNull());
    131102    return m_private->contentDisposition();
    132 }
    133 
    134 void WebBlobData::setContentDisposition(const WebString& contentDisposition)
    135 {
    136     ASSERT(!isNull());
    137     m_private->setContentDisposition(contentDisposition);
    138103}
    139104
  • trunk/WebKit/chromium/src/WebThreadSafeData.cpp

    • Property svn:executable set to *
    r69610 r69611  
    11/*
    22 * Copyright (C) 2010 Google Inc. All rights reserved.
    3  *
     3 * 
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are
    66 * met:
    7  *
     7 * 
    88 *     * Redistributions of source code must retain the above copyright
    99 * notice, this list of conditions and the following disclaimer.
     
    1515 * contributors may be used to endorse or promote products derived from
    1616 * this software without specific prior written permission.
    17  *
     17 * 
    1818 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1919 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    2929 */
    3030
    31 #ifndef WebBlobRegistry_h
    32 #define WebBlobRegistry_h
     31#include "config.h"
     32#include "WebThreadSafeData.h"
    3333
    34 #include "WebBlobStorageData.h"
     34#include "BlobData.h"
     35
     36using namespace WebCore;
    3537
    3638namespace WebKit {
    3739
    38 class WebBlobData;
    39 class WebURL;
     40void WebThreadSafeData::reset()
     41{
     42    m_private.reset();
     43}
    4044
    41 class WebBlobRegistry {
    42 public:
    43     WEBKIT_API static WebBlobRegistry* create();
     45void WebThreadSafeData::assign(const WebThreadSafeData& other)
     46{
     47    m_private = other.m_private;
     48}
    4449
    45     virtual ~WebBlobRegistry() { }
     50size_t WebThreadSafeData::size() const
     51{
     52    if (m_private.isNull())
     53        return 0;
     54    return m_private->length();
     55}
    4656
    47     // Registers a blob URL referring to the specified blob data.
    48     virtual void registerBlobURL(const WebURL&, WebBlobData&) = 0;
    49    
    50     // Registers a blob URL referring to the blob data identified by the specified srcURL.
    51     virtual void registerBlobURL(const WebURL&, const WebURL& srcURL) = 0;
     57const char* WebThreadSafeData::data() const
     58{
     59    if (m_private.isNull())
     60        return 0;
     61    return m_private->data();
     62}
    5263
    53     virtual void unregisterBlobURL(const WebURL&) = 0;
    54 };
     64WebThreadSafeData::WebThreadSafeData(const PassRefPtr<RawData>& data)
     65    : m_private(data.releaseRef())
     66{
     67}
     68
     69WebThreadSafeData& WebThreadSafeData::operator=(const PassRefPtr<RawData>& data)
     70{
     71    m_private = data;
     72    return *this;
     73}
    5574
    5675} // namespace WebKit
    57 
    58 #endif // WebBlobRegistry_h
Note: See TracChangeset for help on using the changeset viewer.