| 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 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/fileapi/Blob.h" | 32 #include "core/fileapi/Blob.h" |
| 33 | 33 |
| 34 #include "core/dom/DOMURL.h" | 34 #include "core/dom/DOMURL.h" |
| 35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
| 36 #include "core/fileapi/File.h" |
| 36 #include "platform/blob/BlobRegistry.h" | 37 #include "platform/blob/BlobRegistry.h" |
| 37 #include "platform/blob/BlobURL.h" | 38 #include "platform/blob/BlobURL.h" |
| 38 | 39 |
| 39 namespace WebCore { | 40 namespace WebCore { |
| 40 | 41 |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 class BlobURLRegistry FINAL : public URLRegistry { | 44 class BlobURLRegistry FINAL : public URLRegistry { |
| 44 public: | 45 public: |
| 45 virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVER
RIDE; | 46 virtual void registerURL(SecurityOrigin*, const KURL&, URLRegistrable*) OVER
RIDE; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 end = 0; | 97 end = 0; |
| 97 if (start >= size) { | 98 if (start >= size) { |
| 98 start = 0; | 99 start = 0; |
| 99 end = 0; | 100 end = 0; |
| 100 } else if (end < start) | 101 } else if (end < start) |
| 101 end = start; | 102 end = start; |
| 102 else if (end > size) | 103 else if (end > size) |
| 103 end = size; | 104 end = size; |
| 104 } | 105 } |
| 105 | 106 |
| 106 PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& conte
ntType) const | 107 PassRefPtrWillBeRawPtr<Blob> Blob::slice(long long start, long long end, const S
tring& contentType) const |
| 107 { | 108 { |
| 108 long long size = this->size(); | 109 long long size = this->size(); |
| 109 clampSliceOffsets(size, start, end); | 110 clampSliceOffsets(size, start, end); |
| 110 | 111 |
| 111 long long length = end - start; | 112 long long length = end - start; |
| 112 OwnPtr<BlobData> blobData = BlobData::create(); | 113 OwnPtr<BlobData> blobData = BlobData::create(); |
| 113 blobData->setContentType(contentType); | 114 blobData->setContentType(contentType); |
| 114 blobData->appendBlob(m_blobDataHandle, start, length); | 115 blobData->appendBlob(m_blobDataHandle, start, length); |
| 115 return Blob::create(BlobDataHandle::create(blobData.release(), length)); | 116 return Blob::create(BlobDataHandle::create(blobData.release(), length)); |
| 116 } | 117 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 138 { | 139 { |
| 139 blobData.appendBlob(m_blobDataHandle, 0, m_blobDataHandle->size()); | 140 blobData.appendBlob(m_blobDataHandle, 0, m_blobDataHandle->size()); |
| 140 } | 141 } |
| 141 | 142 |
| 142 URLRegistry& Blob::registry() const | 143 URLRegistry& Blob::registry() const |
| 143 { | 144 { |
| 144 return BlobURLRegistry::registry(); | 145 return BlobURLRegistry::registry(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace WebCore | 148 } // namespace WebCore |
| OLD | NEW |