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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 return new File(name, metadata, user_visibility); | 116 return new File(name, metadata, user_visibility); |
117 } | 117 } |
118 | 118 |
119 static File* CreateForFileSystemFile(const KURL& url, | 119 static File* CreateForFileSystemFile(const KURL& url, |
120 const FileMetadata& metadata, | 120 const FileMetadata& metadata, |
121 UserVisibility user_visibility) { | 121 UserVisibility user_visibility) { |
122 return new File(url, metadata, user_visibility); | 122 return new File(url, metadata, user_visibility); |
123 } | 123 } |
124 | 124 |
125 KURL FileSystemURL() const { | 125 KURL FileSystemURL() const { |
126 ASSERT(HasValidFileSystemURL()); | 126 #if DCHECK_IS_ON() |
127 DCHECK(HasValidFileSystemURL()); | |
128 #endif | |
127 return file_system_url_; | 129 return file_system_url_; |
128 } | 130 } |
129 | 131 |
130 // Create a file with a name exposed to the author (via File.name and | 132 // Create a file with a name exposed to the author (via File.name and |
131 // associated DOM properties) that differs from the one provided in the path. | 133 // associated DOM properties) that differs from the one provided in the path. |
132 static File* CreateForUserProvidedFile(const String& path, | 134 static File* CreateForUserProvidedFile(const String& path, |
133 const String& display_name) { | 135 const String& display_name) { |
134 if (display_name.IsEmpty()) | 136 if (display_name.IsEmpty()) |
135 return new File(path, File::kAllContentTypes, File::kIsUserVisible); | 137 return new File(path, File::kAllContentTypes, File::kIsUserVisible); |
136 return new File(path, display_name, File::kAllContentTypes, | 138 return new File(path, display_name, File::kAllContentTypes, |
(...skipping 17 matching lines...) Expand all Loading... | |
154 const String& content_type, | 156 const String& content_type, |
155 ExceptionState&) const override; | 157 ExceptionState&) const override; |
156 void close(ScriptState*, ExceptionState&) override; | 158 void close(ScriptState*, ExceptionState&) override; |
157 | 159 |
158 bool IsFile() const override { return true; } | 160 bool IsFile() const override { return true; } |
159 bool HasBackingFile() const override { return has_backing_file_; } | 161 bool HasBackingFile() const override { return has_backing_file_; } |
160 | 162 |
161 void AppendTo(BlobData&) const override; | 163 void AppendTo(BlobData&) const override; |
162 | 164 |
163 const String& GetPath() const { | 165 const String& GetPath() const { |
164 ASSERT(HasValidFilePath()); | 166 #if DCHECK_IS_ON() |
167 DCHECK(HasValidFilePath()); | |
168 #endif | |
alancutter (OOO until 2018)
2017/04/10 00:23:41
Why are these guards necessary?
Hwanseung Lee
2017/04/10 15:01:31
HasValidFilePath() is inside of "#if DCHECK_IS_ON(
| |
165 return path_; | 169 return path_; |
166 } | 170 } |
167 const String& name() const { return name_; } | 171 const String& name() const { return name_; } |
168 | 172 |
169 // Getter for the lastModified IDL attribute, | 173 // Getter for the lastModified IDL attribute, |
170 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs | 174 // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs |
171 long long lastModified() const; | 175 long long lastModified() const; |
172 | 176 |
173 // Getter for the lastModifiedDate IDL attribute, | 177 // Getter for the lastModifiedDate IDL attribute, |
174 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate | 178 // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 const double snapshot_modification_time_ms_; | 248 const double snapshot_modification_time_ms_; |
245 | 249 |
246 String relative_path_; | 250 String relative_path_; |
247 }; | 251 }; |
248 | 252 |
249 DEFINE_TYPE_CASTS(File, Blob, blob, blob->IsFile(), blob.IsFile()); | 253 DEFINE_TYPE_CASTS(File, Blob, blob, blob->IsFile(), blob.IsFile()); |
250 | 254 |
251 } // namespace blink | 255 } // namespace blink |
252 | 256 |
253 #endif // File_h | 257 #endif // File_h |
OLD | NEW |