Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Unified Diff: Source/core/fileapi/Blob.h

Issue 26435003: WebCore blob hacking (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/fileapi/Blob.h
diff --git a/Source/core/fileapi/Blob.h b/Source/core/fileapi/Blob.h
index 958aa283bb1cfbf66c9e73317fd59652f8f76c59..8b5fcd30f0a7b0c067e987e3552453dd8f573eeb 100644
--- a/Source/core/fileapi/Blob.h
+++ b/Source/core/fileapi/Blob.h
@@ -34,7 +34,6 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/html/URLRegistry.h"
#include "core/platform/network/BlobData.h"
-#include "weborigin/KURL.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -48,47 +47,32 @@ class Blob : public ScriptWrappable, public URLRegistrable, public RefCounted<Bl
public:
static PassRefPtr<Blob> create()
{
- return adoptRef(new Blob);
+ return adoptRef(new Blob(BlobDataHandle::create()));
}
- static PassRefPtr<Blob> create(PassOwnPtr<BlobData> blobData, long long size)
+ static PassRefPtr<Blob> create(PassRefPtr<BlobDataHandle> blobDataHandle)
{
- return adoptRef(new Blob(blobData, size));
- }
-
- // For deserialization.
- static PassRefPtr<Blob> create(const KURL& srcURL, const String& type, long long size)
- {
- return adoptRef(new Blob(srcURL, type, size));
+ return adoptRef(new Blob(blobDataHandle));
}
virtual ~Blob();
- const KURL& url() const { return m_internalURL; }
- const String& type() const { return m_type; }
-
- virtual unsigned long long size() const { return static_cast<unsigned long long>(m_size); }
+ 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 bool isFile() 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;
- // URLRegistrable
+ // URLRegistrable to support PublicURLs.
virtual URLRegistry& registry() const OVERRIDE;
- PassRefPtr<Blob> slice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const;
-
protected:
- Blob();
- Blob(PassOwnPtr<BlobData>, long long size);
-
- // For deserialization.
- Blob(const KURL& srcURL, const String& type, long long size);
+ explicit Blob(PassRefPtr<BlobDataHandle>);
- // This is an internal URL referring to the blob data associated with this object. It serves
- // as an identifier for this blob. The internal URL is never used to source the blob's content
- // into an HTML or for FileRead'ing, public blob URLs must be used for those purposes.
- KURL m_internalURL;
-
- String m_type;
- long long m_size;
+private:
+ Blob();
+ RefPtr<BlobDataHandle> m_blobDataHandle;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698