| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 PassRefPtr<File> File::createWithRelativePath(const String& path, const String&
relativePath) | 88 PassRefPtr<File> File::createWithRelativePath(const String& path, const String&
relativePath) |
| 89 { | 89 { |
| 90 RefPtr<File> file = adoptRef(new File(path, AllContentTypes)); | 90 RefPtr<File> file = adoptRef(new File(path, AllContentTypes)); |
| 91 file->m_relativePath = relativePath; | 91 file->m_relativePath = relativePath; |
| 92 return file.release(); | 92 return file.release(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 File::File(const String& path, ContentTypeLookupPolicy policy) | 95 File::File(const String& path, ContentTypeLookupPolicy policy) |
| 96 : Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1)) | 96 : Blob(BlobDataHandle::create(createBlobDataForFile(path, policy), -1)) |
| 97 , m_isOnFilesystem(true) |
| 97 , m_path(path) | 98 , m_path(path) |
| 98 , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path)) | 99 , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path)) |
| 99 , m_snapshotSize(-1) | 100 , m_snapshotSize(-1) |
| 100 , m_snapshotModificationTime(invalidFileTime()) | 101 , m_snapshotModificationTime(invalidFileTime()) |
| 101 { | 102 { |
| 102 ScriptWrappable::init(this); | 103 ScriptWrappable::init(this); |
| 103 } | 104 } |
| 104 | 105 |
| 105 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
y) | 106 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
y) |
| 106 : Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, poli
cy), -1)) | 107 : Blob(BlobDataHandle::create(createBlobDataForFileWithName(path, name, poli
cy), -1)) |
| 108 , m_isOnFilesystem(true) |
| 107 , m_path(path) | 109 , m_path(path) |
| 108 , m_name(name) | 110 , m_name(name) |
| 109 , m_snapshotSize(-1) | 111 , m_snapshotSize(-1) |
| 110 , m_snapshotModificationTime(invalidFileTime()) | 112 , m_snapshotModificationTime(invalidFileTime()) |
| 111 { | 113 { |
| 112 ScriptWrappable::init(this); | 114 ScriptWrappable::init(this); |
| 113 } | 115 } |
| 114 | 116 |
| 115 File::File(const String& path, PassRefPtr<BlobDataHandle> blobDataHandle) | 117 File::File(const String& path, PassRefPtr<BlobDataHandle> blobDataHandle) |
| 116 : Blob(blobDataHandle) | 118 : Blob(blobDataHandle) |
| 119 , m_isOnFilesystem(true) |
| 117 , m_path(path) | 120 , m_path(path) |
| 118 , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path)) | 121 , m_name(WebKit::Platform::current()->fileUtilities()->baseName(path)) |
| 119 , m_snapshotSize(-1) | 122 , m_snapshotSize(-1) |
| 120 , m_snapshotModificationTime(invalidFileTime()) | 123 , m_snapshotModificationTime(invalidFileTime()) |
| 121 { | 124 { |
| 122 ScriptWrappable::init(this); | 125 ScriptWrappable::init(this); |
| 123 // FIXME: File object serialization/deserialization does not include | 126 // FIXME: File object serialization/deserialization does not include |
| 124 // newer file object data members: m_name and m_relativePath. | 127 // newer file object data members: m_name and m_relativePath. |
| 125 // See SerializedScriptValue.cpp. | 128 // See SerializedScriptValue.cpp. |
| 126 } | 129 } |
| 127 | 130 |
| 131 File::File(const String& name, double modificationTime, PassRefPtr<BlobDataHandl
e> blobDataHandle) |
| 132 : Blob(blobDataHandle) |
| 133 , m_isOnFilesystem(false) |
| 134 , m_name(name) |
| 135 , m_snapshotSize(Blob::size()) |
| 136 , m_snapshotModificationTime(modificationTime) |
| 137 { |
| 138 ScriptWrappable::init(this); |
| 139 } |
| 140 |
| 128 File::File(const String& name, const FileMetadata& metadata) | 141 File::File(const String& name, const FileMetadata& metadata) |
| 129 : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metada
ta), metadata.length)) | 142 : Blob(BlobDataHandle::create(createBlobDataForFileWithMetadata(name, metada
ta), metadata.length)) |
| 143 , m_isOnFilesystem(true) |
| 130 , m_path(metadata.platformPath) | 144 , m_path(metadata.platformPath) |
| 131 , m_name(name) | 145 , m_name(name) |
| 132 , m_snapshotSize(metadata.length) | 146 , m_snapshotSize(metadata.length) |
| 133 , m_snapshotModificationTime(metadata.modificationTime) | 147 , m_snapshotModificationTime(metadata.modificationTime) |
| 134 { | 148 { |
| 135 ScriptWrappable::init(this); | 149 ScriptWrappable::init(this); |
| 136 } | 150 } |
| 137 | 151 |
| 138 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) | 152 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) |
| 139 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL,
metadata), metadata.length)) | 153 : Blob(BlobDataHandle::create(createBlobDataForFileSystemURL(fileSystemURL,
metadata), metadata.length)) |
| 154 , m_isOnFilesystem(true) |
| 140 , m_fileSystemURL(fileSystemURL) | 155 , m_fileSystemURL(fileSystemURL) |
| 141 , m_snapshotSize(metadata.length) | 156 , m_snapshotSize(metadata.length) |
| 142 , m_snapshotModificationTime(metadata.modificationTime) | 157 , m_snapshotModificationTime(metadata.modificationTime) |
| 143 { | 158 { |
| 144 ScriptWrappable::init(this); | 159 ScriptWrappable::init(this); |
| 145 } | 160 } |
| 146 | 161 |
| 147 double File::lastModifiedDate() const | 162 double File::lastModifiedDate() const |
| 148 { | 163 { |
| 149 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime
)) | 164 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime
)) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 snapshotSize = 0; | 199 snapshotSize = 0; |
| 185 snapshotModificationTime = invalidFileTime(); | 200 snapshotModificationTime = invalidFileTime(); |
| 186 return; | 201 return; |
| 187 } | 202 } |
| 188 | 203 |
| 189 snapshotSize = metadata.length; | 204 snapshotSize = metadata.length; |
| 190 snapshotModificationTime = metadata.modificationTime; | 205 snapshotModificationTime = metadata.modificationTime; |
| 191 } | 206 } |
| 192 | 207 |
| 193 } // namespace WebCore | 208 } // namespace WebCore |
| OLD | NEW |