OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 bool normalizeLineEndingsToNative = options.endings() == "native"; | 106 bool normalizeLineEndingsToNative = options.endings() == "native"; |
107 | 107 |
108 OwnPtr<BlobData> blobData = BlobData::create(); | 108 OwnPtr<BlobData> blobData = BlobData::create(); |
109 blobData->setContentType(options.type().lower()); | 109 blobData->setContentType(options.type().lower()); |
110 populateBlobData(blobData.get(), fileBits, normalizeLineEndingsToNative); | 110 populateBlobData(blobData.get(), fileBits, normalizeLineEndingsToNative); |
111 | 111 |
112 long long fileSize = blobData->length(); | 112 long long fileSize = blobData->length(); |
113 return File::create(fileName, lastModified, BlobDataHandle::create(blobData.
release(), fileSize)); | 113 return File::create(fileName, lastModified, BlobDataHandle::create(blobData.
release(), fileSize)); |
114 } | 114 } |
115 | 115 |
116 File* File::create(char* data, size_t bytes, const String& mimeType) | 116 File* File::create(const char* data, size_t bytes, const String& mimeType) |
117 { | 117 { |
118 ASSERT(data); | 118 ASSERT(data); |
119 | 119 |
120 OwnPtr<BlobData> blobData = BlobData::create(); | 120 OwnPtr<BlobData> blobData = BlobData::create(); |
121 blobData->setContentType(mimeType); | 121 blobData->setContentType(mimeType); |
122 blobData->appendBytes(data, bytes); | 122 blobData->appendBytes(data, bytes); |
123 long long blobSize = blobData->length(); | 123 long long blobSize = blobData->length(); |
124 | 124 |
125 // create blob as the type of file with two additional attributes -- name an
d lastModificationTime | 125 // create blob as the type of file with two additional attributes -- name an
d lastModificationTime |
126 return File::create("", currentTimeMS(), BlobDataHandle::create(blobData.rel
ease(), blobSize)); | 126 return File::create("", currentTimeMS(), BlobDataHandle::create(blobData.rel
ease(), blobSize)); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty()) | 368 if (m_fileSystemURL.isEmpty() != other.m_fileSystemURL.isEmpty()) |
369 return false; | 369 return false; |
370 | 370 |
371 if (!m_fileSystemURL.isEmpty()) | 371 if (!m_fileSystemURL.isEmpty()) |
372 return m_fileSystemURL == other.m_fileSystemURL; | 372 return m_fileSystemURL == other.m_fileSystemURL; |
373 | 373 |
374 return uuid() == other.uuid(); | 374 return uuid() == other.uuid(); |
375 } | 375 } |
376 | 376 |
377 } // namespace blink | 377 } // namespace blink |
OLD | NEW |