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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef Blob_h | 31 #ifndef Blob_h |
32 #define Blob_h | 32 #define Blob_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "bindings/core/v8/ScriptWrappable.h" |
35 #include "bindings/core/v8/UnionTypesCore.h" | 35 #include "bindings/core/v8/UnionTypesCore.h" |
36 #include "core/CoreExport.h" | 36 #include "core/CoreExport.h" |
37 #include "core/dom/DOMArrayBuffer.h" | 37 #include "core/dom/DOMArrayBuffer.h" |
38 #include "core/dom/DOMArrayBufferView.h" | 38 #include "core/dom/DOMArrayBufferView.h" |
39 #include "core/html/URLRegistry.h" | 39 #include "core/html/URLRegistry.h" |
| 40 #include "core/imagebitmap/ImageBitmapSource.h" |
40 #include "platform/blob/BlobData.h" | 41 #include "platform/blob/BlobData.h" |
41 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
42 #include "wtf/PassRefPtr.h" | 43 #include "wtf/PassRefPtr.h" |
43 #include "wtf/RefCounted.h" | 44 #include "wtf/RefCounted.h" |
44 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
45 | 46 |
46 namespace blink { | 47 namespace blink { |
47 | 48 |
48 class BlobPropertyBag; | 49 class BlobPropertyBag; |
49 class ExceptionState; | 50 class ExceptionState; |
50 class ExecutionContext; | 51 class ExecutionContext; |
51 | 52 |
52 class CORE_EXPORT Blob : public GarbageCollectedFinalized<Blob>, public ScriptWr
appable, public URLRegistrable { | 53 class CORE_EXPORT Blob : public GarbageCollectedFinalized<Blob>, public ScriptWr
appable, public URLRegistrable, public ImageBitmapSource { |
53 DEFINE_WRAPPERTYPEINFO(); | 54 DEFINE_WRAPPERTYPEINFO(); |
54 public: | 55 public: |
55 static Blob* create(ExceptionState&) | 56 static Blob* create(ExceptionState&) |
56 { | 57 { |
57 return new Blob(BlobDataHandle::create()); | 58 return new Blob(BlobDataHandle::create()); |
58 } | 59 } |
59 | 60 |
60 static Blob* create(const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrStr
ing>&, const BlobPropertyBag&, ExceptionState&); | 61 static Blob* create(const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrStr
ing>&, const BlobPropertyBag&, ExceptionState&); |
61 | 62 |
62 static Blob* create(PassRefPtr<BlobDataHandle> blobDataHandle) | 63 static Blob* create(PassRefPtr<BlobDataHandle> blobDataHandle) |
(...skipping 30 matching lines...) Expand all Loading... |
93 // Only true for File instances that are backed by platform files. | 94 // Only true for File instances that are backed by platform files. |
94 virtual bool hasBackingFile() const { return false; } | 95 virtual bool hasBackingFile() const { return false; } |
95 bool hasBeenClosed() const { return m_hasBeenClosed; } | 96 bool hasBeenClosed() const { return m_hasBeenClosed; } |
96 | 97 |
97 // Used by the JavaScript Blob and File constructors. | 98 // Used by the JavaScript Blob and File constructors. |
98 virtual void appendTo(BlobData&) const; | 99 virtual void appendTo(BlobData&) const; |
99 | 100 |
100 // URLRegistrable to support PublicURLs. | 101 // URLRegistrable to support PublicURLs. |
101 URLRegistry& registry() const final; | 102 URLRegistry& registry() const final; |
102 | 103 |
| 104 // ImageBitmapSource implementation |
| 105 bool isBlob() const override { return true; } |
| 106 |
103 DEFINE_INLINE_TRACE() { } | 107 DEFINE_INLINE_TRACE() { } |
104 | 108 |
105 protected: | 109 protected: |
106 explicit Blob(PassRefPtr<BlobDataHandle>); | 110 explicit Blob(PassRefPtr<BlobDataHandle>); |
107 | 111 |
108 template<typename ItemType> | 112 template<typename ItemType> |
109 static void populateBlobData(BlobData* blobData, const HeapVector<ItemType>&
parts, bool normalizeLineEndingsToNative) | 113 static void populateBlobData(BlobData* blobData, const HeapVector<ItemType>&
parts, bool normalizeLineEndingsToNative) |
110 { | 114 { |
111 for (size_t i = 0; i < parts.size(); ++i) { | 115 for (size_t i = 0; i < parts.size(); ++i) { |
112 const ItemType& item = parts[i]; | 116 const ItemType& item = parts[i]; |
(...skipping 17 matching lines...) Expand all Loading... |
130 private: | 134 private: |
131 Blob(); | 135 Blob(); |
132 | 136 |
133 RefPtr<BlobDataHandle> m_blobDataHandle; | 137 RefPtr<BlobDataHandle> m_blobDataHandle; |
134 bool m_hasBeenClosed; | 138 bool m_hasBeenClosed; |
135 }; | 139 }; |
136 | 140 |
137 } // namespace blink | 141 } // namespace blink |
138 | 142 |
139 #endif // Blob_h | 143 #endif // Blob_h |
OLD | NEW |