Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1057)

Side by Side Diff: Source/core/fileapi/File.h

Issue 660763004: Fix the hasBackingFile flag for File backed by a file system URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Add test. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/fileapi/File.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 File(const String& name, const FileMetadata&, UserVisibility); 143 File(const String& name, const FileMetadata&, UserVisibility);
144 File(const KURL& fileSystemURL, const FileMetadata&); 144 File(const KURL& fileSystemURL, const FileMetadata&);
145 145
146 void invalidateSnapshotMetadata() { m_snapshotSize = -1; } 146 void invalidateSnapshotMetadata() { m_snapshotSize = -1; }
147 147
148 // Returns File's last modified time (in MS since Epoch.) 148 // Returns File's last modified time (in MS since Epoch.)
149 // If the modification time isn't known, the current time is returned. 149 // If the modification time isn't known, the current time is returned.
150 double lastModifiedMS() const; 150 double lastModifiedMS() const;
151 151
152 #if ENABLE(ASSERT) 152 #if ENABLE(ASSERT)
153 bool hasValidFileSystemURL() const { return hasBackingFile(); } 153 // Instances backed by a file must have an empty file system URL.
154 bool hasValidFileSystemURL() const { return !hasBackingFile() || m_fileSyste mURL.isEmpty(); }
154 // Instances not backed by a file must have an empty path set. 155 // Instances not backed by a file must have an empty path set.
155 bool hasValidFilePath() const { return hasBackingFile() || m_path.isEmpty(); } 156 bool hasValidFilePath() const { return hasBackingFile() || m_path.isEmpty(); }
156 #endif 157 #endif
157 158
158 bool m_hasBackingFile; 159 bool m_hasBackingFile;
159 UserVisibility m_userVisibility; 160 UserVisibility m_userVisibility;
160 String m_path; 161 String m_path;
161 String m_name; 162 String m_name;
162 163
163 KURL m_fileSystemURL; 164 KURL m_fileSystemURL;
164 165
165 // If m_snapshotSize is negative (initialized to -1 by default), the snapsho t metadata is invalid and we retrieve the latest metadata synchronously in size( ), lastModifiedTime() and slice(). 166 // If m_snapshotSize is negative (initialized to -1 by default), the snapsho t metadata is invalid and we retrieve the latest metadata synchronously in size( ), lastModifiedTime() and slice().
166 // Otherwise, the snapshot metadata are used directly in those methods. 167 // Otherwise, the snapshot metadata are used directly in those methods.
167 long long m_snapshotSize; 168 long long m_snapshotSize;
168 const double m_snapshotModificationTime; 169 const double m_snapshotModificationTime;
169 170
170 String m_relativePath; 171 String m_relativePath;
171 }; 172 };
172 173
173 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile()); 174 DEFINE_TYPE_CASTS(File, Blob, blob, blob->isFile(), blob.isFile());
174 175
175 } // namespace blink 176 } // namespace blink
176 177
177 #endif // File_h 178 #endif // File_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/fileapi/File.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698