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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 #endif | 94 #endif |
95 | 95 |
96 File::File(const String& path, ContentTypeLookupPolicy policy) | 96 File::File(const String& path, ContentTypeLookupPolicy policy) |
97 : Blob(createBlobDataForFile(path, policy), -1) | 97 : Blob(createBlobDataForFile(path, policy), -1) |
98 , m_path(path) | 98 , m_path(path) |
99 , m_name(pathGetFileName(path)) | 99 , m_name(pathGetFileName(path)) |
100 , m_snapshotSize(-1) | 100 , m_snapshotSize(-1) |
101 , m_snapshotModificationTime(invalidFileTime()) | 101 , m_snapshotModificationTime(invalidFileTime()) |
102 { | 102 { |
| 103 ScriptWrappable::init(this); |
103 } | 104 } |
104 | 105 |
105 File::File(const String& path, const KURL& url, const String& type) | 106 File::File(const String& path, const KURL& url, const String& type) |
106 : Blob(url, type, -1) | 107 : Blob(url, type, -1) |
107 , m_path(path) | 108 , m_path(path) |
108 , m_snapshotSize(-1) | 109 , m_snapshotSize(-1) |
109 , m_snapshotModificationTime(invalidFileTime()) | 110 , m_snapshotModificationTime(invalidFileTime()) |
110 { | 111 { |
| 112 ScriptWrappable::init(this); |
111 m_name = pathGetFileName(path); | 113 m_name = pathGetFileName(path); |
112 // FIXME: File object serialization/deserialization does not include | 114 // FIXME: File object serialization/deserialization does not include |
113 // newer file object data members: m_name and m_relativePath. | 115 // newer file object data members: m_name and m_relativePath. |
114 // See SerializedScriptValue.cpp for js and v8. | 116 // See SerializedScriptValue.cpp for js and v8. |
115 } | 117 } |
116 | 118 |
117 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
y) | 119 File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
y) |
118 : Blob(createBlobDataForFileWithName(path, name, policy), -1) | 120 : Blob(createBlobDataForFileWithName(path, name, policy), -1) |
119 , m_path(path) | 121 , m_path(path) |
120 , m_name(name) | 122 , m_name(name) |
121 , m_snapshotSize(-1) | 123 , m_snapshotSize(-1) |
122 , m_snapshotModificationTime(invalidFileTime()) | 124 , m_snapshotModificationTime(invalidFileTime()) |
123 { | 125 { |
| 126 ScriptWrappable::init(this); |
124 } | 127 } |
125 | 128 |
126 File::File(const String& name, const FileMetadata& metadata) | 129 File::File(const String& name, const FileMetadata& metadata) |
127 : Blob(createBlobDataForFileWithMetadata(name, metadata), metadata.length) | 130 : Blob(createBlobDataForFileWithMetadata(name, metadata), metadata.length) |
128 , m_path(metadata.platformPath) | 131 , m_path(metadata.platformPath) |
129 , m_name(name) | 132 , m_name(name) |
130 , m_snapshotSize(metadata.length) | 133 , m_snapshotSize(metadata.length) |
131 , m_snapshotModificationTime(metadata.modificationTime) | 134 , m_snapshotModificationTime(metadata.modificationTime) |
132 { | 135 { |
| 136 ScriptWrappable::init(this); |
133 } | 137 } |
134 | 138 |
135 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) | 139 File::File(const KURL& fileSystemURL, const FileMetadata& metadata) |
136 : Blob(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.len
gth) | 140 : Blob(createBlobDataForFileSystemURL(fileSystemURL, metadata), metadata.len
gth) |
137 , m_fileSystemURL(fileSystemURL) | 141 , m_fileSystemURL(fileSystemURL) |
138 , m_snapshotSize(metadata.length) | 142 , m_snapshotSize(metadata.length) |
139 , m_snapshotModificationTime(metadata.modificationTime) | 143 , m_snapshotModificationTime(metadata.modificationTime) |
140 { | 144 { |
| 145 ScriptWrappable::init(this); |
141 } | 146 } |
142 | 147 |
143 double File::lastModifiedDate() const | 148 double File::lastModifiedDate() const |
144 { | 149 { |
145 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime
)) | 150 if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime
)) |
146 return m_snapshotModificationTime * msPerSecond; | 151 return m_snapshotModificationTime * msPerSecond; |
147 | 152 |
148 time_t modificationTime; | 153 time_t modificationTime; |
149 if (getFileModificationTime(m_path, modificationTime) && isValidFileTime(mod
ificationTime)) | 154 if (getFileModificationTime(m_path, modificationTime) && isValidFileTime(mod
ificationTime)) |
150 return modificationTime * msPerSecond; | 155 return modificationTime * msPerSecond; |
(...skipping 29 matching lines...) Expand all Loading... |
180 snapshotSize = 0; | 185 snapshotSize = 0; |
181 snapshotModificationTime = invalidFileTime(); | 186 snapshotModificationTime = invalidFileTime(); |
182 return; | 187 return; |
183 } | 188 } |
184 | 189 |
185 snapshotSize = metadata.length; | 190 snapshotSize = metadata.length; |
186 snapshotModificationTime = metadata.modificationTime; | 191 snapshotModificationTime = metadata.modificationTime; |
187 } | 192 } |
188 | 193 |
189 } // namespace WebCore | 194 } // namespace WebCore |
OLD | NEW |