Diff
Modified: trunk/Source/WebCore/ChangeLog (238801 => 238802)
--- trunk/Source/WebCore/ChangeLog 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/ChangeLog 2018-12-03 17:50:20 UTC (rev 238802)
@@ -1,3 +1,72 @@
+2018-12-03 Yusuke Suzuki <[email protected]>
+
+ Use WallTime for file time
+ https://bugs.webkit.org/show_bug.cgi?id=192287
+
+ Reviewed by Darin Adler.
+
+ This patch changes a type of file time from double to WallTime to use strongly typed file time.
+
+ No behavior change.
+
+ * Modules/webdatabase/Database.cpp:
+ (WebCore::Database::details const):
+ * Modules/webdatabase/DatabaseDetails.h:
+ (WebCore::DatabaseDetails::DatabaseDetails):
+ (WebCore::DatabaseDetails::creationTime const):
+ (WebCore::DatabaseDetails::modificationTime const):
+ * Modules/webdatabase/DatabaseManager.cpp:
+ (WebCore::DatabaseManager::ProposedDatabase::ProposedDatabase):
+ * Modules/webdatabase/DatabaseTracker.cpp:
+ (WebCore::DatabaseTracker::detailsForNameAndOrigin):
+ * fileapi/AsyncFileStream.cpp:
+ (WebCore::AsyncFileStream::getSize):
+ * fileapi/AsyncFileStream.h:
+ * fileapi/File.cpp:
+ (WebCore::File::lastModified const):
+ * page/Page.cpp:
+ (WebCore::Page::userStyleSheetLocationChanged):
+ (WebCore::Page::userStyleSheet const):
+ * page/Page.h:
+ * platform/FileMetadata.h:
+ * platform/FileStream.cpp:
+ (WebCore::FileStream::getSize):
+ * platform/FileStream.h:
+ * platform/FileSystem.cpp:
+ (WebCore::FileSystem::getFileModificationTime): Deleted.
+ * platform/FileSystem.h:
+ (WebCore::FileSystem::invalidFileTime): Deleted.
+ (WebCore::FileSystem::isValidFileTime): Deleted.
+ * platform/glib/FileSystemGlib.cpp:
+ (WebCore::FileSystem::getFileCreationTime):
+ (WebCore::FileSystem::getFileModificationTime):
+ (WebCore::FileSystem::fileMetadataUsingFunction):
+ * platform/network/BlobDataFileReference.cpp:
+ (WebCore::BlobDataFileReference::BlobDataFileReference):
+ (WebCore::BlobDataFileReference::expectedModificationTime):
+ * platform/network/BlobDataFileReference.h:
+ * platform/network/FormData.cpp:
+ (WebCore::FormData::appendFile):
+ (WebCore::FormData::appendFileRange):
+ * platform/network/FormData.h:
+ (WebCore::FormDataElement::FormDataElement):
+ (WebCore::FormDataElement::EncodedFileData::decode):
+ * platform/network/cf/FormDataStreamCFNet.cpp:
+ (WebCore::advanceCurrentStream):
+ * platform/network/soup/ResourceRequestSoup.cpp:
+ (WebCore::appendEncodedBlobItemToSoupMessageBody):
+ * platform/posix/FileSystemPOSIX.cpp:
+ (WebCore::FileSystem::getFileCreationTime):
+ (WebCore::FileSystem::getFileModificationTime):
+ * platform/sql/SQLiteFileSystem.cpp:
+ (WebCore::SQLiteFileSystem::databaseCreationTime):
+ (WebCore::SQLiteFileSystem::databaseModificationTime):
+ * platform/sql/SQLiteFileSystem.h:
+ * platform/win/FileSystemWin.cpp:
+ (WebCore::FileSystem::getFileModificationTime):
+ (WebCore::FileSystem::getFileCreationTime):
+ (WebCore::FileSystem::findDataToFileMetadata):
+
2018-12-03 Dean Jackson <[email protected]>
Fix iOS Simulator Release test crashes.
Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (238801 => 238802)
--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -638,7 +638,7 @@
DatabaseDetails Database::details() const
{
// This code path is only used for database quota delegate calls, so file dates are irrelevant and left uninitialized.
- return DatabaseDetails(stringIdentifier(), displayName(), estimatedSize(), 0, 0, 0);
+ return DatabaseDetails(stringIdentifier(), displayName(), estimatedSize(), 0, std::nullopt, std::nullopt);
}
void Database::disableAuthorizer()
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h (238801 => 238802)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -28,7 +28,9 @@
#pragma once
+#include <wtf/Markable.h>
#include <wtf/Threading.h>
+#include <wtf/WallTime.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -64,7 +66,7 @@
return *this;
}
- DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage, double creationTime, double modificationTime)
+ DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage, std::optional<WallTime> creationTime, std::optional<WallTime> modificationTime)
: m_name(databaseName)
, m_displayName(displayName)
, m_expectedUsage(expectedUsage)
@@ -78,8 +80,8 @@
const String& displayName() const { return m_displayName; }
uint64_t expectedUsage() const { return m_expectedUsage; }
uint64_t currentUsage() const { return m_currentUsage; }
- double creationTime() const { return m_creationTime; }
- double modificationTime() const { return m_modificationTime; }
+ std::optional<WallTime> creationTime() const { return m_creationTime; }
+ std::optional<WallTime> modificationTime() const { return m_modificationTime; }
#ifndef NDEBUG
Thread& thread() const { return m_thread.get(); }
#endif
@@ -89,8 +91,8 @@
String m_displayName;
uint64_t m_expectedUsage { 0 };
uint64_t m_currentUsage { 0 };
- double m_creationTime { 0.0 };
- double m_modificationTime { 0.0 };
+ Markable<WallTime, WallTime::MarkableTraits> m_creationTime;
+ Markable<WallTime, WallTime::MarkableTraits> m_modificationTime;
#ifndef NDEBUG
Ref<Thread> m_thread { Thread::current() };
#endif
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (238801 => 238802)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -59,7 +59,7 @@
DatabaseManager::ProposedDatabase::ProposedDatabase(DatabaseManager& manager, SecurityOrigin& origin, const String& name, const String& displayName, unsigned long estimatedSize)
: m_manager(manager)
, m_origin(origin.isolatedCopy())
- , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0, 0, 0)
+ , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0, std::nullopt, std::nullopt)
{
m_manager.addProposedDatabase(*this);
}
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (238801 => 238802)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -472,7 +472,7 @@
String path = fullPathForDatabase(origin, name, false);
if (path.isEmpty())
- return DatabaseDetails(name, displayName, expectedUsage, 0, 0, 0);
+ return DatabaseDetails(name, displayName, expectedUsage, 0, std::nullopt, std::nullopt);
return DatabaseDetails(name, displayName, expectedUsage, SQLiteFileSystem::getDatabaseFileSize(path), SQLiteFileSystem::databaseCreationTime(path), SQLiteFileSystem::databaseModificationTime(path));
}
Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.cpp (238801 => 238802)
--- trunk/Source/WebCore/fileapi/AsyncFileStream.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -134,7 +134,7 @@
});
}
-void AsyncFileStream::getSize(const String& path, double expectedModificationTime)
+void AsyncFileStream::getSize(const String& path, std::optional<WallTime> expectedModificationTime)
{
// FIXME: Explicit return type here and in all the other cases like this below is a workaround for a deficiency
// in the Windows compiler at the time of this writing. Could remove it if that is resolved.
Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.h (238801 => 238802)
--- trunk/Source/WebCore/fileapi/AsyncFileStream.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -33,6 +33,7 @@
#include <wtf/Forward.h>
#include <wtf/Function.h>
+#include <wtf/WallTime.h>
namespace WebCore {
@@ -44,7 +45,7 @@
explicit AsyncFileStream(FileStreamClient&);
~AsyncFileStream();
- void getSize(const String& path, double expectedModificationTime);
+ void getSize(const String& path, std::optional<WallTime> expectedModificationTime);
void openForRead(const String& path, long long offset, long long length);
void close();
void read(char* buffer, int length);
Modified: trunk/Source/WebCore/fileapi/File.cpp (238801 => 238802)
--- trunk/Source/WebCore/fileapi/File.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/fileapi/File.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -112,11 +112,11 @@
// FIXME: This does sync-i/o on the main thread and also recalculates every time the method is called.
// The i/o should be performed on a background thread,
// and the result should be cached along with an asynchronous monitor for changes to the file.
- time_t modificationTime;
- if (FileSystem::getFileModificationTime(m_path, modificationTime) && FileSystem::isValidFileTime(modificationTime))
- result = modificationTime * msPerSecond;
+ auto modificationTime = FileSystem::getFileModificationTime(m_path);
+ if (modificationTime)
+ result = modificationTime->secondsSinceEpoch().millisecondsAs<int64_t>();
else
- result = WallTime::now().secondsSinceEpoch().milliseconds();
+ result = WallTime::now().secondsSinceEpoch().millisecondsAs<int64_t>();
return WTF::timeClip(result);
}
Modified: trunk/Source/WebCore/page/Page.cpp (238801 => 238802)
--- trunk/Source/WebCore/page/Page.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/page/Page.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -1347,7 +1347,7 @@
m_didLoadUserStyleSheet = false;
m_userStyleSheet = String();
- m_userStyleSheetModificationTime = 0;
+ m_userStyleSheetModificationTime = std::nullopt;
// Data URLs with base64-encoded UTF-8 style sheets are common. We can process them
// synchronously and avoid using a loader.
@@ -1370,8 +1370,8 @@
if (m_userStyleSheetPath.isEmpty())
return m_userStyleSheet;
- time_t modTime;
- if (!FileSystem::getFileModificationTime(m_userStyleSheetPath, modTime)) {
+ auto modificationTime = FileSystem::getFileModificationTime(m_userStyleSheetPath);
+ if (!modificationTime) {
// The stylesheet either doesn't exist, was just deleted, or is
// otherwise unreadable. If we've read the stylesheet before, we should
// throw away that data now as it no longer represents what's on disk.
@@ -1381,12 +1381,12 @@
// If the stylesheet hasn't changed since the last time we read it, we can
// just return the old data.
- if (m_didLoadUserStyleSheet && modTime <= m_userStyleSheetModificationTime)
+ if (m_didLoadUserStyleSheet && (m_userStyleSheetModificationTime && modificationTime.value() <= m_userStyleSheetModificationTime.value()))
return m_userStyleSheet;
m_didLoadUserStyleSheet = true;
m_userStyleSheet = String();
- m_userStyleSheetModificationTime = modTime;
+ m_userStyleSheetModificationTime = modificationTime;
// FIXME: It would be better to load this asynchronously to avoid blocking
// the process, but we will first need to create an asynchronous loading
Modified: trunk/Source/WebCore/page/Page.h (238801 => 238802)
--- trunk/Source/WebCore/page/Page.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/page/Page.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -811,7 +811,7 @@
String m_userStyleSheetPath;
mutable String m_userStyleSheet;
mutable bool m_didLoadUserStyleSheet { false };
- mutable time_t m_userStyleSheetModificationTime { 0 };
+ mutable std::optional<WallTime> m_userStyleSheetModificationTime;
String m_captionUserPreferencesStyleSheet;
Modified: trunk/Source/WebCore/platform/FileMetadata.h (238801 => 238802)
--- trunk/Source/WebCore/platform/FileMetadata.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/FileMetadata.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -30,11 +30,13 @@
#pragma once
+#include <wtf/WallTime.h>
+
namespace WebCore {
struct FileMetadata {
// The last modification time of the file, in seconds.
- double modificationTime;
+ WallTime modificationTime;
// The length of the file in bytes.
long long length;
Modified: trunk/Source/WebCore/platform/FileStream.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/FileStream.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/FileStream.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -49,14 +49,14 @@
close();
}
-long long FileStream::getSize(const String& path, double expectedModificationTime)
+long long FileStream::getSize(const String& path, std::optional<WallTime> expectedModificationTime)
{
// Check the modification time for the possible file change.
- time_t modificationTime;
- if (!FileSystem::getFileModificationTime(path, modificationTime))
+ auto modificationTime = FileSystem::getFileModificationTime(path);
+ if (!modificationTime)
return -1;
- if (FileSystem::isValidFileTime(expectedModificationTime)) {
- if (static_cast<time_t>(expectedModificationTime) != modificationTime)
+ if (expectedModificationTime) {
+ if (expectedModificationTime->secondsSinceEpoch().secondsAs<time_t>() != modificationTime->secondsSinceEpoch().secondsAs<time_t>())
return -1;
}
Modified: trunk/Source/WebCore/platform/FileStream.h (238801 => 238802)
--- trunk/Source/WebCore/platform/FileStream.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/FileStream.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -43,7 +43,7 @@
// Gets the size of a file. Also validates if the file has been changed or not if the expected modification time is provided, i.e. non-zero.
// Returns total number of bytes if successful. -1 otherwise.
- long long getSize(const String& path, double expectedModificationTime);
+ long long getSize(const String& path, std::optional<WallTime> expectedModificationTime);
// Opens a file for reading. The reading starts at the specified offset and lasts till the specified length.
// Returns true on success. False otherwise.
Modified: trunk/Source/WebCore/platform/FileSystem.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/FileSystem.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/FileSystem.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -361,13 +361,5 @@
return metadata.value().type == FileMetadata::Type::Directory;
}
-std::optional<WallTime> getFileModificationTime(const String& path)
-{
- time_t modificationTime = 0;
- if (!getFileModificationTime(path, modificationTime))
- return std::nullopt;
- return WallTime::fromRawSeconds(modificationTime);
-}
-
} // namespace FileSystem
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/FileSystem.h (238801 => 238802)
--- trunk/Source/WebCore/platform/FileSystem.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/FileSystem.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -104,9 +104,8 @@
WEBCORE_EXPORT bool moveFile(const String& oldPath, const String& newPath);
WEBCORE_EXPORT bool getFileSize(const String&, long long& result);
WEBCORE_EXPORT bool getFileSize(PlatformFileHandle, long long& result);
-WEBCORE_EXPORT bool getFileModificationTime(const String&, time_t& result);
WEBCORE_EXPORT std::optional<WallTime> getFileModificationTime(const String&);
-WEBCORE_EXPORT bool getFileCreationTime(const String&, time_t& result); // Not all platforms store file creation time.
+WEBCORE_EXPORT std::optional<WallTime> getFileCreationTime(const String&); // Not all platforms store file creation time.
WEBCORE_EXPORT std::optional<FileMetadata> fileMetadata(const String& path);
WEBCORE_EXPORT std::optional<FileMetadata> fileMetadataFollowingSymlinks(const String& path);
WEBCORE_EXPORT bool fileIsDirectory(const String&, ShouldFollowSymbolicLinks);
@@ -133,9 +132,6 @@
inline bool isHandleValid(const PlatformFileHandle& handle) { return handle != invalidPlatformFileHandle; }
-inline double invalidFileTime() { return std::numeric_limits<double>::quiet_NaN(); }
-inline bool isValidFileTime(double time) { return std::isfinite(time); }
-
// Prefix is what the filename should be prefixed with, not the full path.
WEBCORE_EXPORT String openTemporaryFile(const String& prefix, PlatformFileHandle&);
WEBCORE_EXPORT PlatformFileHandle openFile(const String& path, FileOpenMode);
Modified: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -151,20 +151,19 @@
return false;
}
-bool getFileCreationTime(const String&, time_t&)
+std::optional<WallTime> getFileCreationTime(const String&)
{
// FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it?
- return false;
+ return std::nullopt;
}
-bool getFileModificationTime(const String& path, time_t& modifiedTime)
+std::optional<WallTime> getFileModificationTime(const String& path)
{
GStatBuf statResult;
if (!getFileStat(path, &statResult))
- return false;
+ return std::nullopt;
- modifiedTime = statResult.st_mtime;
- return true;
+ return WallTime::fromRawSeconds(statResult.st_mtime);
}
static FileMetadata::Type toFileMetataType(GStatBuf statResult)
@@ -186,7 +185,7 @@
bool isHidden = !filename.isEmpty() && filename[0] == '.';
return FileMetadata {
- static_cast<double>(statResult.st_mtime),
+ WallTime::fromRawSeconds(statResult.st_mtime),
statResult.st_size,
isHidden,
toFileMetataType(statResult)
Modified: trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/network/BlobDataFileReference.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -34,11 +34,6 @@
BlobDataFileReference::BlobDataFileReference(const String& path)
: m_path(path)
-#if ENABLE(FILE_REPLACEMENT)
- , m_replacementShouldBeGenerated(false)
-#endif
- , m_size(0)
- , m_expectedModificationTime(FileSystem::invalidFileTime())
{
}
@@ -73,15 +68,14 @@
return m_size;
}
-double BlobDataFileReference::expectedModificationTime()
+std::optional<WallTime> BlobDataFileReference::expectedModificationTime()
{
#if ENABLE(FILE_REPLACEMENT)
// We do not currently track modifications for generated files, because we have a snapshot.
// Unfortunately, this is inconsistent with regular file handling - File objects should be invalidated when underlying files change.
if (m_replacementShouldBeGenerated || !m_replacementPath.isNull())
- return FileSystem::invalidFileTime();
+ return std::nullopt;
#endif
-
return m_expectedModificationTime;
}
Modified: trunk/Source/WebCore/platform/network/BlobDataFileReference.h (238801 => 238802)
--- trunk/Source/WebCore/platform/network/BlobDataFileReference.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/network/BlobDataFileReference.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -26,7 +26,9 @@
#ifndef BlobDataFileReference_h
#define BlobDataFileReference_h
+#include <wtf/Markable.h>
#include <wtf/RefCounted.h>
+#include <wtf/WallTime.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -44,7 +46,7 @@
const String& path();
unsigned long long size();
- double expectedModificationTime();
+ std::optional<WallTime> expectedModificationTime();
virtual void prepareForFileAccess();
virtual void revokeFileAccess();
@@ -60,10 +62,10 @@
String m_path;
#if ENABLE(FILE_REPLACEMENT)
String m_replacementPath;
- bool m_replacementShouldBeGenerated;
+ bool m_replacementShouldBeGenerated { false };
#endif
- unsigned long long m_size;
- double m_expectedModificationTime;
+ unsigned long long m_size { 0 };
+ Markable<WallTime, WallTime::MarkableTraits> m_expectedModificationTime;
};
}
Modified: trunk/Source/WebCore/platform/network/FormData.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/network/FormData.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/network/FormData.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -186,11 +186,11 @@
void FormData::appendFile(const String& filename, bool shouldGenerateFile)
{
- m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, FileSystem::invalidFileTime(), shouldGenerateFile));
+ m_elements.append(FormDataElement(filename, 0, BlobDataItem::toEndOfFile, std::nullopt, shouldGenerateFile));
m_lengthInBytes = std::nullopt;
}
-void FormData::appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile)
+void FormData::appendFileRange(const String& filename, long long start, long long length, std::optional<WallTime> expectedModificationTime, bool shouldGenerateFile)
{
m_elements.append(FormDataElement(filename, start, length, expectedModificationTime, shouldGenerateFile));
m_lengthInBytes = std::nullopt;
Modified: trunk/Source/WebCore/platform/network/FormData.h (238801 => 238802)
--- trunk/Source/WebCore/platform/network/FormData.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/network/FormData.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -45,7 +45,7 @@
: data(WTFMove(data)) { }
explicit FormDataElement(Vector<char>&& array)
: data(WTFMove(array)) { }
- FormDataElement(const String& filename, int64_t fileStart, int64_t fileLength, double expectedFileModificationTime, bool shouldGenerateFile)
+ FormDataElement(const String& filename, int64_t fileStart, int64_t fileLength, std::optional<WallTime> expectedFileModificationTime, bool shouldGenerateFile)
: data(EncodedFileData { filename, fileStart, fileLength, expectedFileModificationTime, { }, shouldGenerateFile, false }) { }
explicit FormDataElement(const URL& blobURL)
: data(EncodedBlobData { blobURL }) { }
@@ -71,7 +71,7 @@
String filename;
int64_t fileStart { 0 };
int64_t fileLength { 0 };
- double expectedFileModificationTime { 0 };
+ std::optional<WallTime> expectedFileModificationTime;
String generatedFilename;
bool shouldGenerateFile { false };
bool ownsGeneratedFile { false };
@@ -116,7 +116,7 @@
if (!fileLength)
return std::nullopt;
- std::optional<double> expectedFileModificationTime;
+ std::optional<std::optional<WallTime>> expectedFileModificationTime;
decoder >> expectedFileModificationTime;
if (!expectedFileModificationTime)
return std::nullopt;
@@ -218,7 +218,7 @@
WEBCORE_EXPORT void appendData(const void* data, size_t);
void appendFile(const String& filePath, bool shouldGenerateFile = false);
- WEBCORE_EXPORT void appendFileRange(const String& filename, long long start, long long length, double expectedModificationTime, bool shouldGenerateFile = false);
+ WEBCORE_EXPORT void appendFileRange(const String& filename, long long start, long long length, std::optional<WallTime> expectedModificationTime, bool shouldGenerateFile = false);
WEBCORE_EXPORT void appendBlob(const URL& blobURL);
Vector<char> flatten() const; // omits files
Modified: trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -145,10 +145,12 @@
return true;
}, [form] (const FormDataElement::EncodedFileData& fileData) {
// Check if the file has been changed or not if required.
- if (FileSystem::isValidFileTime(fileData.expectedFileModificationTime)) {
- time_t fileModificationTime;
- if (!FileSystem::getFileModificationTime(fileData.filename, fileModificationTime) || fileModificationTime != static_cast<time_t>(fileData.expectedFileModificationTime))
+ if (fileData.expectedFileModificationTime) {
+ auto fileModificationTime = FileSystem::getFileModificationTime(fileData.filename);
+ if (!fileModificationTime)
return false;
+ if (fileModificationTime->secondsSinceEpoch().secondsAs<time_t>() != fileData.expectedFileModificationTime->secondsSinceEpoch().secondsAs<time_t>())
+ return false;
}
const String& path = fileData.shouldGenerateFile ? fileData.generatedFilename : fileData.filename;
form->currentStream = CFReadStreamCreateWithFile(0, FileSystem::pathAsURL(path).get());
Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -41,14 +41,16 @@
soup_message_body_append(soupMessage->request_body, SOUP_MEMORY_TEMPORARY, blobItem.data().data()->data() + blobItem.offset(), blobItem.length());
return blobItem.length();
case BlobDataItem::Type::File: {
- if (!FileSystem::isValidFileTime(blobItem.file()->expectedModificationTime()))
+ if (!blobItem.file()->expectedModificationTime())
return 0;
- time_t fileModificationTime;
- if (!FileSystem::getFileModificationTime(blobItem.file()->path(), fileModificationTime)
- || fileModificationTime != static_cast<time_t>(blobItem.file()->expectedModificationTime()))
+ auto fileModificationTime = FileSystem::getFileModificationTime(blobItem.file()->path());
+ if (!fileModificationTime)
return 0;
+ if (fileModificationTime->secondsSinceEpoch().secondsAs<time_t>() != blobItem.file()->expectedModificationTime()->secondsSinceEpoch().secondsAs<time_t>())
+ return 0;
+
if (RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(blobItem.file()->path())) {
if (buffer->isEmpty())
return 0;
Modified: trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -202,42 +202,39 @@
return true;
}
-bool getFileCreationTime(const String& path, time_t& result)
+std::optional<WallTime> getFileCreationTime(const String& path)
{
#if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
CString fsRep = fileSystemRepresentation(path);
if (!fsRep.data() || fsRep.data()[0] == '\0')
- return false;
+ return std::nullopt;
struct stat fileInfo;
if (stat(fsRep.data(), &fileInfo))
- return false;
+ return std::nullopt;
- result = fileInfo.st_birthtime;
- return true;
+ return WallTime::fromRawSeconds(fileInfo.st_birthtime);
#else
UNUSED_PARAM(path);
- UNUSED_PARAM(result);
- return false;
+ return std::nullopt;
#endif
}
-bool getFileModificationTime(const String& path, time_t& result)
+std::optional<WallTime> getFileModificationTime(const String& path)
{
CString fsRep = fileSystemRepresentation(path);
if (!fsRep.data() || fsRep.data()[0] == '\0')
- return false;
+ return std::nullopt;
struct stat fileInfo;
if (stat(fsRep.data(), &fileInfo))
- return false;
+ return std::nullopt;
- result = fileInfo.st_mtime;
- return true;
+ return WallTime::fromRawSeconds(fileInfo.st_mtime);
}
static FileMetadata::Type toFileMetataType(struct stat fileInfo)
@@ -263,7 +260,7 @@
String filename = pathGetFileName(path);
bool isHidden = !filename.isEmpty() && filename[0] == '.';
return FileMetadata {
- static_cast<double>(fileInfo.st_mtime),
+ WallTime::fromRawSeconds(fileInfo.st_mtime),
fileInfo.st_size,
isHidden,
toFileMetataType(fileInfo)
Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -108,16 +108,14 @@
return FileSystem::getFileSize(fileName, size) ? size : 0;
}
-double SQLiteFileSystem::databaseCreationTime(const String& fileName)
+std::optional<WallTime> SQLiteFileSystem::databaseCreationTime(const String& fileName)
{
- time_t time;
- return FileSystem::getFileCreationTime(fileName, time) ? time : 0;
+ return FileSystem::getFileCreationTime(fileName);
}
-double SQLiteFileSystem::databaseModificationTime(const String& fileName)
+std::optional<WallTime> SQLiteFileSystem::databaseModificationTime(const String& fileName)
{
- time_t time;
- return FileSystem::getFileModificationTime(fileName, time) ? time : 0;
+ return FileSystem::getFileModificationTime(fileName);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h (238801 => 238802)
--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -97,8 +97,8 @@
#endif
static long long getDatabaseFileSize(const String& fileName);
- WEBCORE_EXPORT static double databaseCreationTime(const String& fileName);
- WEBCORE_EXPORT static double databaseModificationTime(const String& fileName);
+ WEBCORE_EXPORT static std::optional<WallTime> databaseCreationTime(const String& fileName);
+ WEBCORE_EXPORT static std::optional<WallTime> databaseModificationTime(const String& fileName);
private:
// do not instantiate this class
Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (238801 => 238802)
--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -124,24 +124,26 @@
return getFileSizeFromByHandleFileInformationStructure(fileInformation, size);
}
-bool getFileModificationTime(const String& path, time_t& time)
+std::optional<WallTime> getFileModificationTime(const String& path)
{
WIN32_FIND_DATAW findData;
if (!getFindData(path, findData))
- return false;
+ return std::nullopt;
+ time_t time = 0;
getFileModificationTimeFromFindData(findData, time);
- return true;
+ return WallTime::fromRawSeconds(time);
}
-bool getFileCreationTime(const String& path, time_t& time)
+std::optional<WallTime> getFileCreationTime(const String& path)
{
WIN32_FIND_DATAW findData;
if (!getFindData(path, findData))
- return false;
+ return std::nullopt;
+ time_t time = 0;
getFileCreationTimeFromFindData(findData, time);
- return true;
+ return WallTime::fromRawSeconds(time);
}
static String getFinalPathName(const String& path)
@@ -185,7 +187,7 @@
getFileModificationTimeFromFindData(findData, modificationTime);
return FileMetadata {
- static_cast<double>(modificationTime),
+ WallTime::fromRawSeconds(modificationTime),
length,
static_cast<bool>(findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN),
toFileMetadataType(findData)
Modified: trunk/Source/WebKit/ChangeLog (238801 => 238802)
--- trunk/Source/WebKit/ChangeLog 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/ChangeLog 2018-12-03 17:50:20 UTC (rev 238802)
@@ -1,3 +1,39 @@
+2018-12-03 Yusuke Suzuki <[email protected]>
+
+ Use WallTime for file time
+ https://bugs.webkit.org/show_bug.cgi?id=192287
+
+ Reviewed by Darin Adler.
+
+ * Shared/SessionState.h:
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<DatabaseDetails>::decode):
+ * UIProcess/API/C/WKKeyValueStorageManager.cpp:
+ (WKKeyValueStorageManagerGetStorageDetailsByOrigin):
+ * UIProcess/API/glib/WebKitWebViewSessionState.cpp:
+ (decodeHTTPBody):
+ * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
+ (WebKit::PluginInfoCache::getPluginInfo):
+ (WebKit::PluginInfoCache::updatePluginInfo):
+ * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
+ (WebKit::hasFileChangedSince):
+ * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
+ (WebKit::LocalStorageDatabaseTracker::databasesModifiedSince):
+ (WebKit::LocalStorageDatabaseTracker::originDetails):
+ * UIProcess/WebStorage/LocalStorageDatabaseTracker.h:
+ * UIProcess/mac/LegacySessionStateCoding.cpp:
+ (WebKit::encodeFormDataElement):
+ (WebKit::decodeFormDataElement):
+ * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
+ (WebKit::removeAllMediaKeyStorageForOriginPath):
+ (WebKit::WebMediaKeyStorageManager::deleteMediaKeyEntriesForOrigin):
+ (WebKit::WebMediaKeyStorageManager::deleteMediaKeyEntriesModifiedBetweenDates):
+ (WebKit::WebMediaKeyStorageManager::deleteAllMediaKeyEntries):
+ * WebProcess/MediaCache/WebMediaKeyStorageManager.h:
+ * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
+ (WebKit::toHTTPBody):
+ (WebKit::toFormData):
+
2018-12-03 Darin Adler <[email protected]>
[Cocoa] Check message IDs when decoding Mach messages in IPC::Connection
Modified: trunk/Source/WebKit/Shared/SessionState.h (238801 => 238802)
--- trunk/Source/WebKit/Shared/SessionState.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/Shared/SessionState.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -69,7 +69,7 @@
String filePath;
int64_t fileStart;
std::optional<int64_t> fileLength;
- std::optional<double> expectedFileModificationTime;
+ std::optional<WallTime> expectedFileModificationTime;
// Blob.
String blobURLString;
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (238801 => 238802)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -1622,11 +1622,11 @@
if (!decoder.decode(currentUsage))
return false;
- double creationTime;
+ std::optional<WallTime> creationTime;
if (!decoder.decode(creationTime))
return false;
- double modificationTime;
+ std::optional<WallTime> modificationTime;
if (!decoder.decode(modificationTime))
return false;
Modified: trunk/Source/WebKit/UIProcess/API/C/WKKeyValueStorageManager.cpp (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/API/C/WKKeyValueStorageManager.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/API/C/WKKeyValueStorageManager.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -102,9 +102,9 @@
detailsMap.set(toImpl(WKKeyValueStorageManagerGetOriginKey())->string(), origin);
if (originDetails.creationTime)
- detailsMap.set(toImpl(WKKeyValueStorageManagerGetCreationTimeKey())->string(), API::Double::create(originDetails.creationTime.secondsSinceEpoch().value()));
+ detailsMap.set(toImpl(WKKeyValueStorageManagerGetCreationTimeKey())->string(), API::Double::create(originDetails.creationTime->secondsSinceEpoch().value()));
if (originDetails.modificationTime)
- detailsMap.set(toImpl(WKKeyValueStorageManagerGetModificationTimeKey())->string(), API::Double::create(originDetails.modificationTime.secondsSinceEpoch().value()));
+ detailsMap.set(toImpl(WKKeyValueStorageManagerGetModificationTimeKey())->string(), API::Double::create(originDetails.modificationTime->secondsSinceEpoch().value()));
result.uncheckedAppend(API::Dictionary::create(WTFMove(detailsMap)));
}
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewSessionState.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -271,7 +271,7 @@
if (hasFileLength)
element.fileLength = fileLength;
if (hasFileModificationTime)
- element.expectedFileModificationTime = fileModificationTime;
+ element.expectedFileModificationTime = WallTime::fromRawSeconds(fileModificationTime);
element.blobURLString = String::fromUTF8(blobURLString);
httpBody.elements.uncheckedAppend(WTFMove(element));
Modified: trunk/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/Plugins/gtk/PluginInfoCache.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -112,11 +112,11 @@
if (!g_key_file_has_group(m_cacheFile.get(), pluginGroup.data()))
return false;
- time_t lastModified;
- if (!WebCore::FileSystem::getFileModificationTime(pluginPath, lastModified))
+ auto lastModifiedTime = WebCore::FileSystem::getFileModificationTime(pluginPath);
+ if (!lastModifiedTime)
return false;
time_t cachedLastModified = static_cast<time_t>(g_key_file_get_uint64(m_cacheFile.get(), pluginGroup.data(), "mtime", nullptr));
- if (lastModified != cachedLastModified)
+ if (lastModifiedTime->secondsSinceEpoch().secondsAs<time_t>() != cachedLastModified)
return false;
plugin.path = pluginPath;
@@ -140,12 +140,12 @@
void PluginInfoCache::updatePluginInfo(const String& pluginPath, const PluginModuleInfo& plugin)
{
- time_t lastModified;
- if (!WebCore::FileSystem::getFileModificationTime(pluginPath, lastModified))
+ auto lastModifiedTime = WebCore::FileSystem::getFileModificationTime(pluginPath);
+ if (!lastModifiedTime)
return;
CString pluginGroup = pluginPath.utf8();
- g_key_file_set_uint64(m_cacheFile.get(), pluginGroup.data(), "mtime", static_cast<guint64>(lastModified));
+ g_key_file_set_uint64(m_cacheFile.get(), pluginGroup.data(), "mtime", lastModifiedTime->secondsSinceEpoch().secondsAs<guint64>());
g_key_file_set_string(m_cacheFile.get(), pluginGroup.data(), "name", plugin.info.name.utf8().data());
g_key_file_set_string(m_cacheFile.get(), pluginGroup.data(), "description", plugin.info.desc.utf8().data());
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -45,11 +45,11 @@
static bool hasFileChangedSince(const String& path, WallTime since)
{
ASSERT(!RunLoop::isMain());
- time_t modificationTime;
- if (!FileSystem::getFileModificationTime(path, modificationTime))
+ auto modificationTime = FileSystem::getFileModificationTime(path);
+ if (!modificationTime)
return true;
- return WallTime::fromRawSeconds(modificationTime) > since;
+ return modificationTime.value() > since;
}
static std::unique_ptr<KeyedDecoder> createDecoderForFile(const String& path)
Modified: trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -102,8 +102,11 @@
for (auto origin : databaseOrigins) {
auto path = databasePath(origin);
- auto modificationTime = WallTime::fromRawSeconds(SQLiteFileSystem::databaseModificationTime(path));
- if (modificationTime >= time)
+ auto modificationTime = SQLiteFileSystem::databaseModificationTime(path);
+ if (!modificationTime)
+ continue;
+
+ if (modificationTime.value() >= time)
databaseOriginsModified.append(origin);
}
@@ -139,8 +142,8 @@
OriginDetails details;
details.originIdentifier = origin.databaseIdentifier();
- details.creationTime = WallTime::fromRawSeconds(SQLiteFileSystem::databaseCreationTime(path));
- details.modificationTime = WallTime::fromRawSeconds(SQLiteFileSystem::databaseModificationTime(path));
+ details.creationTime = SQLiteFileSystem::databaseCreationTime(path);
+ details.modificationTime = SQLiteFileSystem::databaseModificationTime(path);
result.uncheckedAppend(details);
}
Modified: trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.h (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -27,6 +27,7 @@
#include <WebCore/SecurityOriginData.h>
#include <wtf/HashSet.h>
+#include <wtf/Markable.h>
#include <wtf/Optional.h>
#include <wtf/RefPtr.h>
#include <wtf/ThreadSafeRefCounted.h>
@@ -57,8 +58,8 @@
struct OriginDetails {
String originIdentifier;
- WallTime creationTime;
- WallTime modificationTime;
+ Markable<WallTime, WallTime::MarkableTraits> creationTime;
+ Markable<WallTime, WallTime::MarkableTraits> modificationTime;
};
Vector<OriginDetails> originDetails();
Modified: trunk/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp (238801 => 238802)
--- trunk/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/UIProcess/mac/LegacySessionStateCoding.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -285,7 +285,7 @@
encoder << element.fileStart;
encoder << element.fileLength.value_or(-1);
- encoder << element.expectedFileModificationTime.value_or(std::numeric_limits<double>::quiet_NaN());
+ encoder << element.expectedFileModificationTime.value_or(WallTime::nan()).secondsSinceEpoch().value();
break;
case HTTPBody::Element::Type::Blob:
@@ -827,11 +827,10 @@
formDataElement.fileLength = fileLength;
}
-
double expectedFileModificationTime;
decoder >> expectedFileModificationTime;
- if (expectedFileModificationTime != std::numeric_limits<double>::quiet_NaN())
- formDataElement.expectedFileModificationTime = expectedFileModificationTime;
+ if (!std::isnan(expectedFileModificationTime))
+ formDataElement.expectedFileModificationTime = WallTime::fromRawSeconds(expectedFileModificationTime);
break;
}
Modified: trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp (238801 => 238802)
--- trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -79,7 +79,7 @@
return results;
}
-static void removeAllMediaKeyStorageForOriginPath(const String& originPath, double startDate, double endDate)
+static void removeAllMediaKeyStorageForOriginPath(const String& originPath, WallTime startDate, WallTime endDate)
{
Vector<String> mediaKeyPaths = FileSystem::listDirectory(originPath, "*");
@@ -89,11 +89,11 @@
if (!FileSystem::fileExists(mediaKeyFile))
continue;
- time_t modTime;
- FileSystem::getFileModificationTime(mediaKeyFile, modTime);
-
- if (modTime < startDate || modTime > endDate)
+ auto modificationTime = FileSystem::getFileModificationTime(mediaKeyFile);
+ if (!modificationTime)
continue;
+ if (modificationTime.value() < startDate || modificationTime.value() > endDate)
+ continue;
FileSystem::deleteFile(mediaKeyFile);
FileSystem::deleteEmptyDirectory(mediaKeyPath);
@@ -108,10 +108,10 @@
return;
String originPath = mediaKeyStorageDirectoryForOrigin(originData);
- removeAllMediaKeyStorageForOriginPath(originPath, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
+ removeAllMediaKeyStorageForOriginPath(originPath, -WallTime::infinity(), WallTime::infinity());
}
-void WebMediaKeyStorageManager::deleteMediaKeyEntriesModifiedBetweenDates(double startDate, double endDate)
+void WebMediaKeyStorageManager::deleteMediaKeyEntriesModifiedBetweenDates(WallTime startDate, WallTime endDate)
{
if (m_mediaKeyStorageDirectory.isEmpty())
return;
@@ -128,7 +128,7 @@
Vector<String> originPaths = FileSystem::listDirectory(m_mediaKeyStorageDirectory, "*");
for (auto& originPath : originPaths)
- removeAllMediaKeyStorageForOriginPath(originPath, std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
+ removeAllMediaKeyStorageForOriginPath(originPath, -WallTime::infinity(), WallTime::infinity());
}
}
Modified: trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.h (238801 => 238802)
--- trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.h 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/WebProcess/MediaCache/WebMediaKeyStorageManager.h 2018-12-03 17:50:20 UTC (rev 238802)
@@ -27,6 +27,7 @@
#include "WebProcessSupplement.h"
#include <wtf/Noncopyable.h>
+#include <wtf/WallTime.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -50,7 +51,7 @@
Vector<WebCore::SecurityOriginData> getMediaKeyOrigins();
void deleteMediaKeyEntriesForOrigin(const WebCore::SecurityOriginData&);
- void deleteMediaKeyEntriesModifiedBetweenDates(double startDate, double endDate);
+ void deleteMediaKeyEntriesModifiedBetweenDates(WallTime startDate, WallTime endDate);
void deleteAllMediaKeyEntries();
private:
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp (238801 => 238802)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/SessionStateConversion.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -51,8 +51,7 @@
element.fileStart = fileData.fileStart;
if (fileData.fileLength != BlobDataItem::toEndOfFile)
element.fileLength = fileData.fileLength;
- if (fileData.expectedFileModificationTime != FileSystem::invalidFileTime())
- element.expectedFileModificationTime = fileData.expectedFileModificationTime;
+ element.expectedFileModificationTime = fileData.expectedFileModificationTime;
}, [&] (const FormDataElement::EncodedBlobData& blobData) {
element.blobURLString = blobData.url.string();
}
@@ -129,7 +128,7 @@
break;
case HTTPBody::Element::Type::File:
- formData->appendFileRange(element.filePath, element.fileStart, element.fileLength.value_or(BlobDataItem::toEndOfFile), element.expectedFileModificationTime.value_or(FileSystem::invalidFileTime()));
+ formData->appendFileRange(element.filePath, element.fileStart, element.fileLength.value_or(BlobDataItem::toEndOfFile), element.expectedFileModificationTime);
break;
case HTTPBody::Element::Type::Blob:
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (238801 => 238802)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2018-12-03 17:50:20 UTC (rev 238802)
@@ -1,3 +1,13 @@
+2018-12-03 Yusuke Suzuki <[email protected]>
+
+ Use WallTime for file time
+ https://bugs.webkit.org/show_bug.cgi?id=192287
+
+ Reviewed by Darin Adler.
+
+ * Plugins/PluginDatabase.cpp:
+ (WebCore::PluginDatabase::refresh):
+
2018-11-30 Alex Christensen <[email protected]>
Fix Windows build.
Modified: trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp (238801 => 238802)
--- trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp 2018-12-03 17:48:59 UTC (rev 238801)
+++ trunk/Source/WebKitLegacy/win/Plugins/PluginDatabase.cpp 2018-12-03 17:50:20 UTC (rev 238802)
@@ -125,9 +125,10 @@
auto pathsEnd = paths.end();
for (auto it = paths.begin(); it != pathsEnd; ++it) {
- time_t lastModified;
- if (!FileSystem::getFileModificationTime(*it, lastModified))
+ auto lastModifiedTime = FileSystem::getFileModificationTime(*it);
+ if (!lastModifiedTime)
continue;
+ time_t lastModified = lastModifiedTime->secondsSinceEpoch().secondsAs<time_t>();
pathsWithTimes.add(*it, lastModified);