| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "weborigin/KURL.h" | 35 #include "weborigin/KURL.h" |
| 36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
| 37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
| 38 #include "wtf/ThreadSafeRefCounted.h" | 38 #include "wtf/ThreadSafeRefCounted.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class BlobDataHandle; | 43 class BlobDataHandle; |
| 44 | 44 |
| 45 class RawData : public ThreadSafeRefCounted<RawData> { | 45 class PLATFORM_EXPORT RawData : public ThreadSafeRefCounted<RawData> { |
| 46 public: | 46 public: |
| 47 static PassRefPtr<RawData> create() | 47 static PassRefPtr<RawData> create() |
| 48 { | 48 { |
| 49 return adoptRef(new RawData()); | 49 return adoptRef(new RawData()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void detachFromCurrentThread(); | 52 void detachFromCurrentThread(); |
| 53 | 53 |
| 54 const char* data() const { return m_data.data(); } | 54 const char* data() const { return m_data.data(); } |
| 55 size_t length() const { return m_data.size(); } | 55 size_t length() const { return m_data.size(); } |
| 56 Vector<char>* mutableData() { return &m_data; } | 56 Vector<char>* mutableData() { return &m_data; } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 RawData(); | 59 RawData(); |
| 60 | 60 |
| 61 Vector<char> m_data; | 61 Vector<char> m_data; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 struct BlobDataItem { | 64 struct PLATFORM_EXPORT BlobDataItem { |
| 65 static const long long toEndOfFile; | 65 static const long long toEndOfFile; |
| 66 | 66 |
| 67 // Default constructor. | 67 // Default constructor. |
| 68 BlobDataItem() | 68 BlobDataItem() |
| 69 : type(Data) | 69 : type(Data) |
| 70 , offset(0) | 70 , offset(0) |
| 71 , length(toEndOfFile) | 71 , length(toEndOfFile) |
| 72 , expectedModificationTime(invalidFileTime()) | 72 , expectedModificationTime(invalidFileTime()) |
| 73 { | 73 { |
| 74 } | 74 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 , data(data) | 151 , data(data) |
| 152 , offset(offset) | 152 , offset(offset) |
| 153 , length(length) | 153 , length(length) |
| 154 , expectedModificationTime(invalidFileTime()) | 154 , expectedModificationTime(invalidFileTime()) |
| 155 { | 155 { |
| 156 } | 156 } |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 typedef Vector<BlobDataItem> BlobDataItemList; | 159 typedef Vector<BlobDataItem> BlobDataItemList; |
| 160 | 160 |
| 161 class BlobData { | 161 class PLATFORM_EXPORT BlobData { |
| 162 WTF_MAKE_FAST_ALLOCATED; | 162 WTF_MAKE_FAST_ALLOCATED; |
| 163 public: | 163 public: |
| 164 static PassOwnPtr<BlobData> create(); | 164 static PassOwnPtr<BlobData> create(); |
| 165 | 165 |
| 166 // Detaches from current thread so that it can be passed to another thread. | 166 // Detaches from current thread so that it can be passed to another thread. |
| 167 void detachFromCurrentThread(); | 167 void detachFromCurrentThread(); |
| 168 | 168 |
| 169 const String& contentType() const { return m_contentType; } | 169 const String& contentType() const { return m_contentType; } |
| 170 void setContentType(const String& contentType) { m_contentType = contentType
; } | 170 void setContentType(const String& contentType) { m_contentType = contentType
; } |
| 171 | 171 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 189 | 189 |
| 190 // This is only exposed to BlobStorageData. | 190 // This is only exposed to BlobStorageData. |
| 191 void appendData(const RawData&, long long offset, long long length); | 191 void appendData(const RawData&, long long offset, long long length); |
| 192 | 192 |
| 193 String m_contentType; | 193 String m_contentType; |
| 194 String m_contentDisposition; | 194 String m_contentDisposition; |
| 195 BlobDataItemList m_items; | 195 BlobDataItemList m_items; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 | 198 |
| 199 class BlobDataHandle : public ThreadSafeRefCounted<BlobDataHandle> { | 199 class PLATFORM_EXPORT BlobDataHandle : public ThreadSafeRefCounted<BlobDataHandl
e> { |
| 200 public: | 200 public: |
| 201 // For empty blob construction. | 201 // For empty blob construction. |
| 202 static PassRefPtr<BlobDataHandle> create() | 202 static PassRefPtr<BlobDataHandle> create() |
| 203 { | 203 { |
| 204 return adoptRef(new BlobDataHandle()); | 204 return adoptRef(new BlobDataHandle()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 // For initial creation. | 207 // For initial creation. |
| 208 static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long lon
g size) | 208 static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long lon
g size) |
| 209 { | 209 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 228 BlobDataHandle(const String& uuid, const String& type, long long size); | 228 BlobDataHandle(const String& uuid, const String& type, long long size); |
| 229 | 229 |
| 230 const String m_uuid; | 230 const String m_uuid; |
| 231 const String m_type; | 231 const String m_type; |
| 232 const long long m_size; | 232 const long long m_size; |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 } // namespace WebCore | 235 } // namespace WebCore |
| 236 | 236 |
| 237 #endif // BlobData_h | 237 #endif // BlobData_h |
| OLD | NEW |