| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return; | 115 return; |
| 116 if (blob->isFile()) { | 116 if (blob->isFile()) { |
| 117 File* file = toFile(blob); | 117 File* file = toFile(blob); |
| 118 // If the blob is file that is not snapshoted, capture the snapshot now. | 118 // If the blob is file that is not snapshoted, capture the snapshot now. |
| 119 // FIXME: This involves synchronous file operation. We need to figure ou
t how to make it asynchronous. | 119 // FIXME: This involves synchronous file operation. We need to figure ou
t how to make it asynchronous. |
| 120 long long snapshotSize; | 120 long long snapshotSize; |
| 121 double snapshotModificationTime; | 121 double snapshotModificationTime; |
| 122 file->captureSnapshot(snapshotSize, snapshotModificationTime); | 122 file->captureSnapshot(snapshotSize, snapshotModificationTime); |
| 123 | 123 |
| 124 m_size += snapshotSize; | 124 m_size += snapshotSize; |
| 125 #if ENABLE(FILE_SYSTEM) | |
| 126 if (!file->fileSystemURL().isEmpty()) | 125 if (!file->fileSystemURL().isEmpty()) |
| 127 m_items.append(BlobDataItem(file->fileSystemURL(), 0, snapshotSize,
snapshotModificationTime)); | 126 m_items.append(BlobDataItem(file->fileSystemURL(), 0, snapshotSize,
snapshotModificationTime)); |
| 128 else | 127 else |
| 129 #endif | 128 m_items.append(BlobDataItem(file->path(), 0, snapshotSize, snapshotM
odificationTime)); |
| 130 m_items.append(BlobDataItem(file->path(), 0, snapshotSize, snapshotModif
icationTime)); | |
| 131 } else { | 129 } else { |
| 132 long long blobSize = static_cast<long long>(blob->size()); | 130 long long blobSize = static_cast<long long>(blob->size()); |
| 133 m_size += blobSize; | 131 m_size += blobSize; |
| 134 m_items.append(BlobDataItem(blob->url(), 0, blobSize)); | 132 m_items.append(BlobDataItem(blob->url(), 0, blobSize)); |
| 135 } | 133 } |
| 136 } | 134 } |
| 137 | 135 |
| 138 void BlobBuilder::appendBytesData(const void* data, size_t length) | 136 void BlobBuilder::appendBytesData(const void* data, size_t length) |
| 139 { | 137 { |
| 140 Vector<char>& buffer = getBuffer(); | 138 Vector<char>& buffer = getBuffer(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 152 RefPtr<Blob> blob = Blob::create(blobData.release(), m_size); | 150 RefPtr<Blob> blob = Blob::create(blobData.release(), m_size); |
| 153 | 151 |
| 154 // After creating a blob from the current blob data, we do not need to keep
the data around any more. Instead, we only | 152 // After creating a blob from the current blob data, we do not need to keep
the data around any more. Instead, we only |
| 155 // need to keep a reference to the URL of the blob just created. | 153 // need to keep a reference to the URL of the blob just created. |
| 156 m_items.append(BlobDataItem(blob->url(), 0, m_size)); | 154 m_items.append(BlobDataItem(blob->url(), 0, m_size)); |
| 157 | 155 |
| 158 return blob; | 156 return blob; |
| 159 } | 157 } |
| 160 | 158 |
| 161 } // namespace WebCore | 159 } // namespace WebCore |
| OLD | NEW |