| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL,
metadata), metadata.length)) | 152 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL,
metadata), metadata.length)) |
| 153 , m_hasBackingFile(true) | 153 , m_hasBackingFile(true) |
| 154 , m_userVisibility(File::IsNotUserVisible) | 154 , m_userVisibility(File::IsNotUserVisible) |
| 155 , m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent())) | 155 , m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent())) |
| 156 , m_fileSystemURL(fileSystemURL) | 156 , m_fileSystemURL(fileSystemURL) |
| 157 , m_snapshotSize(metadata.length) | 157 , m_snapshotSize(metadata.length) |
| 158 , m_snapshotModificationTime(metadata.modificationTime) | 158 , m_snapshotModificationTime(metadata.modificationTime) |
| 159 { | 159 { |
| 160 } | 160 } |
| 161 | 161 |
| 162 File::File(const File& other) |
| 163 : Blob(other.blobDataHandle()) |
| 164 , m_hasBackingFile(other.m_hasBackingFile) |
| 165 , m_userVisibility(other.m_userVisibility) |
| 166 , m_path(other.m_path) |
| 167 , m_name(other.m_name) |
| 168 , m_fileSystemURL(other.m_fileSystemURL) |
| 169 , m_snapshotSize(other.m_snapshotSize) |
| 170 , m_snapshotModificationTime(other.m_snapshotModificationTime) |
| 171 , m_relativePath(other.m_relativePath) |
| 172 { |
| 173 } |
| 174 |
| 175 PassRefPtrWillBeRawPtr<File> File::clone(const String& name) const |
| 176 { |
| 177 RefPtrWillBeRawPtr<File> file = adoptRefWillBeNoop(new File(*this)); |
| 178 if (!name.isNull()) |
| 179 file->m_name = name; |
| 180 return file.release(); |
| 181 } |
| 182 |
| 162 double File::lastModifiedMS() const | 183 double File::lastModifiedMS() const |
| 163 { | 184 { |
| 164 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime
)) | 185 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime
)) |
| 165 return m_snapshotModificationTime * msPerSecond; | 186 return m_snapshotModificationTime * msPerSecond; |
| 166 | 187 |
| 167 time_t modificationTime; | 188 time_t modificationTime; |
| 168 if (hasBackingFile() && getFileModificationTime(m_path, modificationTime) &&
isValidFileTime(modificationTime)) | 189 if (hasBackingFile() && getFileModificationTime(m_path, modificationTime) &&
isValidFileTime(modificationTime)) |
| 169 return modificationTime * msPerSecond; | 190 return modificationTime * msPerSecond; |
| 170 | 191 |
| 171 return currentTime() * msPerSecond; | 192 return currentTime() * msPerSecond; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 captureSnapshot(size, modificationTime); | 311 captureSnapshot(size, modificationTime); |
| 291 if (!m_fileSystemURL.isEmpty()) { | 312 if (!m_fileSystemURL.isEmpty()) { |
| 292 blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime)
; | 313 blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime)
; |
| 293 return; | 314 return; |
| 294 } | 315 } |
| 295 ASSERT(!m_path.isEmpty()); | 316 ASSERT(!m_path.isEmpty()); |
| 296 blobData.appendFile(m_path, 0, size, modificationTime); | 317 blobData.appendFile(m_path, 0, size, modificationTime); |
| 297 } | 318 } |
| 298 | 319 |
| 299 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |