| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return new Blob(BlobDataHandle::create()); | 57 return new Blob(BlobDataHandle::create()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static Blob* create(const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrStr
ing>&, const BlobPropertyBag&, ExceptionState&); | 60 static Blob* create(const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrStr
ing>&, const BlobPropertyBag&, ExceptionState&); |
| 61 | 61 |
| 62 static Blob* create(PassRefPtr<BlobDataHandle> blobDataHandle) | 62 static Blob* create(PassRefPtr<BlobDataHandle> blobDataHandle) |
| 63 { | 63 { |
| 64 return new Blob(blobDataHandle); | 64 return new Blob(blobDataHandle); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual ~Blob(); | 67 ~Blob() override; |
| 68 | 68 |
| 69 virtual unsigned long long size() const { return m_blobDataHandle->size(); } | 69 virtual unsigned long long size() const { return m_blobDataHandle->size(); } |
| 70 virtual Blob* slice(long long start, long long end, const String& contentTyp
e, ExceptionState&) const; | 70 virtual Blob* slice(long long start, long long end, const String& contentTyp
e, ExceptionState&) const; |
| 71 | 71 |
| 72 // To allow ExceptionState to be passed in last, manually enumerate the opti
onal argument overloads. | 72 // To allow ExceptionState to be passed in last, manually enumerate the opti
onal argument overloads. |
| 73 Blob* slice(ExceptionState& exceptionState) const | 73 Blob* slice(ExceptionState& exceptionState) const |
| 74 { | 74 { |
| 75 return slice(0, std::numeric_limits<long long>::max(), String(), excepti
onState); | 75 return slice(0, std::numeric_limits<long long>::max(), String(), excepti
onState); |
| 76 } | 76 } |
| 77 Blob* slice(long long start, ExceptionState& exceptionState) const | 77 Blob* slice(long long start, ExceptionState& exceptionState) const |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 // True for all File instances, including the user-built ones. | 91 // True for all File instances, including the user-built ones. |
| 92 virtual bool isFile() const { return false; } | 92 virtual bool isFile() const { return false; } |
| 93 // Only true for File instances that are backed by platform files. | 93 // Only true for File instances that are backed by platform files. |
| 94 virtual bool hasBackingFile() const { return false; } | 94 virtual bool hasBackingFile() const { return false; } |
| 95 bool hasBeenClosed() const { return m_hasBeenClosed; } | 95 bool hasBeenClosed() const { return m_hasBeenClosed; } |
| 96 | 96 |
| 97 // Used by the JavaScript Blob and File constructors. | 97 // Used by the JavaScript Blob and File constructors. |
| 98 virtual void appendTo(BlobData&) const; | 98 virtual void appendTo(BlobData&) const; |
| 99 | 99 |
| 100 // URLRegistrable to support PublicURLs. | 100 // URLRegistrable to support PublicURLs. |
| 101 virtual URLRegistry& registry() const override final; | 101 URLRegistry& registry() const final; |
| 102 | 102 |
| 103 DEFINE_INLINE_TRACE() { } | 103 DEFINE_INLINE_TRACE() { } |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 explicit Blob(PassRefPtr<BlobDataHandle>); | 106 explicit Blob(PassRefPtr<BlobDataHandle>); |
| 107 | 107 |
| 108 template<typename ItemType> | 108 template<typename ItemType> |
| 109 static void populateBlobData(BlobData* blobData, const HeapVector<ItemType>&
parts, bool normalizeLineEndingsToNative) | 109 static void populateBlobData(BlobData* blobData, const HeapVector<ItemType>&
parts, bool normalizeLineEndingsToNative) |
| 110 { | 110 { |
| 111 for (size_t i = 0; i < parts.size(); ++i) { | 111 for (size_t i = 0; i < parts.size(); ++i) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 130 private: | 130 private: |
| 131 Blob(); | 131 Blob(); |
| 132 | 132 |
| 133 RefPtr<BlobDataHandle> m_blobDataHandle; | 133 RefPtr<BlobDataHandle> m_blobDataHandle; |
| 134 bool m_hasBeenClosed; | 134 bool m_hasBeenClosed; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 } // namespace blink | 137 } // namespace blink |
| 138 | 138 |
| 139 #endif // Blob_h | 139 #endif // Blob_h |
| OLD | NEW |