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

Unified Diff: Source/core/fileapi/File.cpp

Issue 458953002: Remove custom getters for File.lastModified{Date} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Preserve comment Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/fileapi/File.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/File.cpp
diff --git a/Source/core/fileapi/File.cpp b/Source/core/fileapi/File.cpp
index afdc11ce20ef6f4d61def78a32a3bc58be7eaa21..5b10bd836197b95bc2ef21b73b93126f0248dc1e 100644
--- a/Source/core/fileapi/File.cpp
+++ b/Source/core/fileapi/File.cpp
@@ -165,7 +165,7 @@ File::File(const KURL& fileSystemURL, const FileMetadata& metadata)
ScriptWrappable::init(this);
}
-double File::lastModifiedDate() const
+double File::lastModifiedMS() const
{
if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime))
return m_snapshotModificationTime * msPerSecond;
@@ -177,6 +177,32 @@ double File::lastModifiedDate() const
return currentTime() * msPerSecond;
}
+long long File::lastModified() const
+{
+ double modifiedDate = lastModifiedMS();
+
+ // The getter should return the current time when the last modification time isn't known.
+ if (!isValidFileTime(modifiedDate))
+ modifiedDate = currentTimeMS();
+
+ // lastModified returns a number, not a Date instance,
+ // http://dev.w3.org/2006/webapi/FileAPI/#file-attrs
+ return floor(modifiedDate);
+}
+
+double File::lastModifiedDate() const
+{
+ double modifiedDate = lastModifiedMS();
+
+ // The getter should return the current time when the last modification time isn't known.
+ if (!isValidFileTime(modifiedDate))
+ modifiedDate = currentTimeMS();
+
+ // lastModifiedDate returns a Date instance,
+ // http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate
+ return modifiedDate;
+}
+
unsigned long long File::size() const
{
if (hasValidSnapshotMetadata())
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/fileapi/File.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698