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

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

Issue 884393002: Upgrade Blink to milliseconds-based last modified filetimes, part 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sof-fileinfo-modtime-in-ms-1
Patch Set: Stop using time_t over getFileModificationTime(); not sound Created 5 years, 10 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/html/FormDataList.cpp » ('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 f5d29392e208215be120a23485995820901c4322..f96efd7968419de1a057dfe17f8cb6f55786a65c 100644
--- a/Source/core/fileapi/File.cpp
+++ b/Source/core/fileapi/File.cpp
@@ -74,7 +74,7 @@ static PassOwnPtr<BlobData> createBlobDataForFileWithMetadata(const String& file
{
OwnPtr<BlobData> blobData = BlobData::create();
blobData->setContentType(getContentTypeFromFileName(fileSystemName, File::WellKnownContentTypes));
- blobData->appendFile(metadata.platformPath, 0, metadata.length, metadata.modificationTime);
+ blobData->appendFile(metadata.platformPath, 0, metadata.length, metadata.modificationTimeMS / msPerSecond);
return blobData.release();
}
@@ -82,7 +82,7 @@ static PassOwnPtr<BlobData> createBlobDataForFileSystemURL(const KURL& fileSyste
{
OwnPtr<BlobData> blobData = BlobData::create();
blobData->setContentType(getContentTypeFromFileName(fileSystemURL.path(), File::WellKnownContentTypes));
- blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.modificationTime);
+ blobData->appendFileSystemURL(fileSystemURL, 0, metadata.length, metadata.modificationTimeMS / msPerSecond);
return blobData.release();
}
@@ -100,7 +100,7 @@ File::File(const String& path, ContentTypeLookupPolicy policy, UserVisibility us
, m_path(path)
, m_name(Platform::current()->fileUtilities()->baseName(path))
, m_snapshotSize(-1)
- , m_snapshotModificationTime(invalidFileTime())
+ , m_snapshotModificationTimeMS(invalidFileTime())
{
}
@@ -111,7 +111,7 @@ File::File(const String& path, const String& name, ContentTypeLookupPolicy polic
, m_path(path)
, m_name(name)
, m_snapshotSize(-1)
- , m_snapshotModificationTime(invalidFileTime())
+ , m_snapshotModificationTimeMS(invalidFileTime())
{
}
@@ -122,18 +122,18 @@ File::File(const String& path, const String& name, const String& relativePath, U
, m_path(path)
, m_name(name)
, m_snapshotSize(hasSnaphotData ? static_cast<long long>(size) : -1)
- , m_snapshotModificationTime(hasSnaphotData ? lastModified : invalidFileTime())
+ , m_snapshotModificationTimeMS(hasSnaphotData ? lastModified : invalidFileTime())
, m_relativePath(relativePath)
{
}
-File::File(const String& name, double modificationTime, PassRefPtr<BlobDataHandle> blobDataHandle)
+File::File(const String& name, double modificationTimeMS, PassRefPtr<BlobDataHandle> blobDataHandle)
: Blob(blobDataHandle)
, m_hasBackingFile(false)
, m_userVisibility(File::IsNotUserVisible)
, m_name(name)
, m_snapshotSize(Blob::size())
- , m_snapshotModificationTime(modificationTime)
+ , m_snapshotModificationTimeMS(modificationTimeMS)
{
}
@@ -144,7 +144,7 @@ File::File(const String& name, const FileMetadata& metadata, UserVisibility user
, m_path(metadata.platformPath)
, m_name(name)
, m_snapshotSize(metadata.length)
- , m_snapshotModificationTime(metadata.modificationTime)
+ , m_snapshotModificationTimeMS(metadata.modificationTimeMS)
{
}
@@ -155,7 +155,7 @@ File::File(const KURL& fileSystemURL, const FileMetadata& metadata, UserVisibili
, m_name(decodeURLEscapeSequences(fileSystemURL.lastPathComponent()))
, m_fileSystemURL(fileSystemURL)
, m_snapshotSize(metadata.length)
- , m_snapshotModificationTime(metadata.modificationTime)
+ , m_snapshotModificationTimeMS(metadata.modificationTimeMS)
{
}
@@ -167,7 +167,7 @@ File::File(const File& other)
, m_name(other.m_name)
, m_fileSystemURL(other.m_fileSystemURL)
, m_snapshotSize(other.m_snapshotSize)
- , m_snapshotModificationTime(other.m_snapshotModificationTime)
+ , m_snapshotModificationTimeMS(other.m_snapshotModificationTimeMS)
, m_relativePath(other.m_relativePath)
{
}
@@ -182,14 +182,14 @@ File* File::clone(const String& name) const
double File::lastModifiedMS() const
{
- if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTime))
- return m_snapshotModificationTime * msPerSecond;
+ if (hasValidSnapshotMetadata() && isValidFileTime(m_snapshotModificationTimeMS))
+ return m_snapshotModificationTimeMS;
- time_t modificationTime;
- if (hasBackingFile() && getFileModificationTime(m_path, modificationTime) && isValidFileTime(modificationTime))
- return modificationTime * msPerSecond;
+ double modificationTimeMS;
+ if (hasBackingFile() && getFileModificationTime(m_path, modificationTimeMS) && isValidFileTime(modificationTimeMS))
+ return modificationTimeMS;
- return currentTime() * msPerSecond;
+ return currentTimeMS();
}
long long File::lastModified() const
@@ -243,27 +243,27 @@ Blob* File::slice(long long start, long long end, const String& contentType, Exc
// FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous.
long long size;
- double modificationTime;
- captureSnapshot(size, modificationTime);
+ double modificationTimeMS;
+ captureSnapshot(size, modificationTimeMS);
clampSliceOffsets(size, start, end);
long long length = end - start;
OwnPtr<BlobData> blobData = BlobData::create();
blobData->setContentType(contentType);
if (!m_fileSystemURL.isEmpty()) {
- blobData->appendFileSystemURL(m_fileSystemURL, start, length, modificationTime);
+ blobData->appendFileSystemURL(m_fileSystemURL, start, length, modificationTimeMS / msPerSecond);
} else {
ASSERT(!m_path.isEmpty());
- blobData->appendFile(m_path, start, length, modificationTime);
+ blobData->appendFile(m_path, start, length, modificationTimeMS / msPerSecond);
}
return Blob::create(BlobDataHandle::create(blobData.release(), length));
}
-void File::captureSnapshot(long long& snapshotSize, double& snapshotModificationTime) const
+void File::captureSnapshot(long long& snapshotSize, double& snapshotModificationTimeMS) const
{
if (hasValidSnapshotMetadata()) {
snapshotSize = m_snapshotSize;
- snapshotModificationTime = m_snapshotModificationTime;
+ snapshotModificationTimeMS = m_snapshotModificationTimeMS;
return;
}
@@ -272,12 +272,12 @@ void File::captureSnapshot(long long& snapshotSize, double& snapshotModification
FileMetadata metadata;
if (!hasBackingFile() || !getFileMetadata(m_path, metadata)) {
snapshotSize = 0;
- snapshotModificationTime = invalidFileTime();
+ snapshotModificationTimeMS = invalidFileTime();
return;
}
snapshotSize = metadata.length;
- snapshotModificationTime = metadata.modificationTime;
+ snapshotModificationTimeMS = metadata.modificationTimeMS;
}
void File::close(ExecutionContext* executionContext, ExceptionState& exceptionState)
@@ -307,14 +307,14 @@ void File::appendTo(BlobData& blobData) const
// FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous.
long long size;
- double modificationTime;
- captureSnapshot(size, modificationTime);
+ double modificationTimeMS;
+ captureSnapshot(size, modificationTimeMS);
if (!m_fileSystemURL.isEmpty()) {
- blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTime);
+ blobData.appendFileSystemURL(m_fileSystemURL, 0, size, modificationTimeMS / msPerSecond);
return;
}
ASSERT(!m_path.isEmpty());
- blobData.appendFile(m_path, 0, size, modificationTime);
+ blobData.appendFile(m_path, 0, size, modificationTimeMS / msPerSecond);
}
bool File::hasSameSource(const File& other) const
« no previous file with comments | « Source/core/fileapi/File.h ('k') | Source/core/html/FormDataList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698