summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/network/BlobData.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/network/BlobData.cpp')
-rw-r--r--WebCore/platform/network/BlobData.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/WebCore/platform/network/BlobData.cpp b/WebCore/platform/network/BlobData.cpp
index 21e8917..ff39ecc 100644
--- a/WebCore/platform/network/BlobData.cpp
+++ b/WebCore/platform/network/BlobData.cpp
@@ -31,40 +31,46 @@
#include "config.h"
#include "BlobData.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+
namespace WebCore {
const long long BlobDataItem::toEndOfFile = -1;
const double BlobDataItem::doNotCheckFileChange = 0;
-void BlobDataItem::copy(const BlobDataItem& item)
+RawData::RawData()
{
- type = item.type;
- data = item.data; // This is OK because the underlying storage is Vector<char>.
- path = item.path.crossThreadString();
- url = item.url.copy();
- offset = item.offset;
- length = item.length;
- expectedModificationTime = item.expectedModificationTime;
}
-PassOwnPtr<BlobData> BlobData::copy() const
+void RawData::detachFromCurrentThread()
{
- OwnPtr<BlobData> blobData = adoptPtr(new BlobData());
- blobData->m_contentType = m_contentType.crossThreadString();
- blobData->m_contentDisposition = m_contentDisposition.crossThreadString();
- blobData->m_items.resize(m_items.size());
- for (size_t i = 0; i < m_items.size(); ++i)
- blobData->m_items.at(i).copy(m_items.at(i));
+}
+
+void BlobDataItem::detachFromCurrentThread()
+{
+ data->detachFromCurrentThread();
+ path = path.crossThreadString();
+ url = url.copy();
+}
- return blobData.release();
+PassOwnPtr<BlobData> BlobData::create()
+{
+ return adoptPtr(new BlobData());
}
-void BlobData::appendData(const CString& data)
+void BlobData::detachFromCurrentThread()
{
- m_items.append(BlobDataItem(data));
+ m_contentType = m_contentType.crossThreadString();
+ m_contentDisposition = m_contentDisposition.crossThreadString();
+ for (size_t i = 0; i < m_items.size(); ++i)
+ m_items.at(i).detachFromCurrentThread();
}
-void BlobData::appendData(const CString& data, long long offset, long long length)
+void BlobData::appendData(PassRefPtr<RawData> data, long long offset, long long length)
{
m_items.append(BlobDataItem(data, offset, length));
}