| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 SliceWithoutPrefix, | 47 SliceWithoutPrefix, |
| 48 SliceWithPrefix, | 48 SliceWithPrefix, |
| 49 SliceHistogramEnumMax, | 49 SliceHistogramEnumMax, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 Blob::Blob() | 54 Blob::Blob() |
| 55 : m_size(0) | 55 : m_size(0) |
| 56 { | 56 { |
| 57 ScriptWrappable::init(this); |
| 57 OwnPtr<BlobData> blobData = BlobData::create(); | 58 OwnPtr<BlobData> blobData = BlobData::create(); |
| 58 | 59 |
| 59 // Create a new internal URL and register it with the provided blob data. | 60 // Create a new internal URL and register it with the provided blob data. |
| 60 m_internalURL = BlobURL::createInternalURL(); | 61 m_internalURL = BlobURL::createInternalURL(); |
| 61 ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData.release()); | 62 ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData.release()); |
| 62 } | 63 } |
| 63 | 64 |
| 64 Blob::Blob(PassOwnPtr<BlobData> blobData, long long size) | 65 Blob::Blob(PassOwnPtr<BlobData> blobData, long long size) |
| 65 : m_type(blobData->contentType()) | 66 : m_type(blobData->contentType()) |
| 66 , m_size(size) | 67 , m_size(size) |
| 67 { | 68 { |
| 68 ASSERT(blobData); | 69 ASSERT(blobData); |
| 70 ScriptWrappable::init(this); |
| 69 | 71 |
| 70 // Create a new internal URL and register it with the provided blob data. | 72 // Create a new internal URL and register it with the provided blob data. |
| 71 m_internalURL = BlobURL::createInternalURL(); | 73 m_internalURL = BlobURL::createInternalURL(); |
| 72 ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData); | 74 ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData); |
| 73 } | 75 } |
| 74 | 76 |
| 75 Blob::Blob(const KURL& srcURL, const String& type, long long size) | 77 Blob::Blob(const KURL& srcURL, const String& type, long long size) |
| 76 : m_type(type) | 78 : m_type(type) |
| 77 , m_size(size) | 79 , m_size(size) |
| 78 { | 80 { |
| 81 ScriptWrappable::init(this); |
| 82 |
| 79 // Create a new internal URL and register it with the same blob data as the
source URL. | 83 // Create a new internal URL and register it with the same blob data as the
source URL. |
| 80 m_internalURL = BlobURL::createInternalURL(); | 84 m_internalURL = BlobURL::createInternalURL(); |
| 81 ThreadableBlobRegistry::registerBlobURL(0, m_internalURL, srcURL); | 85 ThreadableBlobRegistry::registerBlobURL(0, m_internalURL, srcURL); |
| 82 } | 86 } |
| 83 | 87 |
| 84 Blob::~Blob() | 88 Blob::~Blob() |
| 85 { | 89 { |
| 86 ThreadableBlobRegistry::unregisterBlobURL(m_internalURL); | 90 ThreadableBlobRegistry::unregisterBlobURL(m_internalURL); |
| 87 } | 91 } |
| 88 | 92 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 blobData->appendURL(toFile(this)->fileSystemURL(), start, length, mo
dificationTime); | 131 blobData->appendURL(toFile(this)->fileSystemURL(), start, length, mo
dificationTime); |
| 128 else | 132 else |
| 129 blobData->appendFile(toFile(this)->path(), start, length, modificati
onTime); | 133 blobData->appendFile(toFile(this)->path(), start, length, modificati
onTime); |
| 130 } else | 134 } else |
| 131 blobData->appendBlob(m_internalURL, start, length); | 135 blobData->appendBlob(m_internalURL, start, length); |
| 132 | 136 |
| 133 return Blob::create(blobData.release(), length); | 137 return Blob::create(blobData.release(), length); |
| 134 } | 138 } |
| 135 | 139 |
| 136 } // namespace WebCore | 140 } // namespace WebCore |
| OLD | NEW |