diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/fileapi/Blob.h')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/fileapi/Blob.h | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/chromium/third_party/WebKit/Source/core/fileapi/Blob.h b/chromium/third_party/WebKit/Source/core/fileapi/Blob.h index 6a721554590..76af6e718e1 100644 --- a/chromium/third_party/WebKit/Source/core/fileapi/Blob.h +++ b/chromium/third_party/WebKit/Source/core/fileapi/Blob.h @@ -34,6 +34,7 @@ #include "bindings/v8/ScriptWrappable.h" #include "core/html/URLRegistry.h" #include "platform/blob/BlobData.h" +#include "platform/heap/Handle.h" #include "wtf/PassOwnPtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" @@ -41,41 +42,68 @@ namespace WebCore { +class ExceptionState; class ExecutionContext; -class Blob : public ScriptWrappable, public URLRegistrable, public RefCounted<Blob> { +class Blob : public RefCountedWillBeGarbageCollectedFinalized<Blob>, public ScriptWrappable, public URLRegistrable { public: - static PassRefPtr<Blob> create() + static PassRefPtrWillBeRawPtr<Blob> create() { - return adoptRef(new Blob(BlobDataHandle::create())); + return adoptRefWillBeNoop(new Blob(BlobDataHandle::create())); } - static PassRefPtr<Blob> create(PassRefPtr<BlobDataHandle> blobDataHandle) + static PassRefPtrWillBeRawPtr<Blob> create(PassRefPtr<BlobDataHandle> blobDataHandle) { - return adoptRef(new Blob(blobDataHandle)); + return adoptRefWillBeNoop(new Blob(blobDataHandle)); } virtual ~Blob(); - String uuid() const { return m_blobDataHandle->uuid(); } - String type() const { return m_blobDataHandle->type(); } virtual unsigned long long size() const { return m_blobDataHandle->size(); } + virtual PassRefPtrWillBeRawPtr<Blob> slice(long long start, long long end, const String& contentType, ExceptionState&) const; + + // To allow ExceptionState to be passed in last, manually enumerate the optional argument overloads. + PassRefPtrWillBeRawPtr<Blob> slice(ExceptionState& exceptionState) const + { + return slice(0, std::numeric_limits<long long>::max(), String(), exceptionState); + } + PassRefPtrWillBeRawPtr<Blob> slice(long long start, ExceptionState& exceptionState) const + { + return slice(start, std::numeric_limits<long long>::max(), String(), exceptionState); + } + PassRefPtrWillBeRawPtr<Blob> slice(long long start, long long end, ExceptionState& exceptionState) const + { + return slice(start, end, String(), exceptionState); + } + + virtual void close(ExecutionContext*, ExceptionState&); + + String type() const { return m_blobDataHandle->type(); } + String uuid() const { return m_blobDataHandle->uuid(); } + PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; } // True for all File instances, including the user-built ones. virtual bool isFile() const { return false; } // Only true for File instances that are backed by platform files. virtual bool hasBackingFile() const { return false; } - PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle; } - PassRefPtr<Blob> slice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const; + bool hasBeenClosed() const { return m_hasBeenClosed; } + + // Used by the JavaScript Blob and File constructors. + virtual void appendTo(BlobData&) const; // URLRegistrable to support PublicURLs. - virtual URLRegistry& registry() const OVERRIDE; + virtual URLRegistry& registry() const OVERRIDE FINAL; + + void trace(Visitor*) { } protected: explicit Blob(PassRefPtr<BlobDataHandle>); + static void clampSliceOffsets(long long size, long long& start, long long& end); private: Blob(); + RefPtr<BlobDataHandle> m_blobDataHandle; + bool m_hasBeenClosed; }; } // namespace WebCore |