<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162943] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162943">162943</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-01-28 10:18:47 -0800 (Tue, 28 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Expose SQL database creation and modification times
https://bugs.webkit.org/show_bug.cgi?id=127728
Reviewed by Brady Eidson.
Source/WebCore:
* platform/FileSystem.h:
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::getFileCreationTime):
* platform/win/FileSystemWin.cpp:
(WebCore::getFileCreationTimeFromFindData):
(WebCore::getFileCreationTime):
Added functions to get file creation times. Not all OSes support that, but Darwin
and Windows do, as (I think) various BSD flavors.
* platform/gtk/FileSystemGtk.cpp: Added a stub for getFileCreationTime().
* platform/sql/SQLiteFileSystem.h:
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::databaseCreationTime):
(WebCore::SQLiteFileSystem::databaseModificationTime):
Expose it in the same strange manner other database file operations are.
* Modules/webdatabase/DatabaseDetails.h:
(WebCore::DatabaseDetails::DatabaseDetails):
(WebCore::DatabaseDetails::creationTime):
(WebCore::DatabaseDetails::modificationTime):
Added creation and modification times to DatabaseDetails.
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::ProposedDatabase::ProposedDatabase):
(WebCore::DatabaseManager::openDatabaseBackend):
ProposedDatabase is an unfortunate mechanism for communicating quota errors to the
client, we should really straighten it up. But for now, just leave the times uninitialized.
* Modules/webdatabase/DatabaseBackendBase.cpp: (WebCore::DatabaseBackendBase::details):
This code path is for handling quota errors, so there is no need to initialize most
of DatabaseDetails here as well.
* Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::detailsForNameAndOrigin):
* Modules/webdatabase/DatabaseTracker.h:
Fill in database file times. Inlined and removed usageForDatabase function to
avoid rebuilding the path multiple times.
Source/WebKit2:
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<DatabaseDetails>::encode):
(IPC::ArgumentCoder<DatabaseDetails>::decode):
Encode and decode new DatabaseDetails member variables.
* UIProcess/API/C/WKDatabaseManager.cpp:
(WKDatabaseManagerGetDatabaseDetailsCreationTimeKey):
(WKDatabaseManagerGetDatabaseDetailsModificationTimeKey):
* UIProcess/API/C/WKDatabaseManager.h:
Added new keys for database details.
* UIProcess/WebDatabaseManagerProxy.cpp:
(WebKit::WebDatabaseManagerProxy::databaseDetailsCreationTimeKey):
(WebKit::WebDatabaseManagerProxy::databaseDetailsModificationTimeKey):
(WebKit::WebDatabaseManagerProxy::didGetDatabasesByOrigin):
* UIProcess/WebDatabaseManagerProxy.h:
Set the new keys if times are valid.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseBackendBasecpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseDetailsh">trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseManagercpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseTrackercpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseTrackerh">trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h</a></li>
<li><a href="#trunkSourceWebCoreplatformFileSystemh">trunk/Source/WebCore/platform/FileSystem.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkFileSystemGtkcpp">trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformposixFileSystemPOSIXcpp">trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformsqlSQLiteFileSystemcpp">trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformsqlSQLiteFileSystemh">trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h</a></li>
<li><a href="#trunkSourceWebCoreplatformwinFileSystemWincpp">trunk/Source/WebCore/platform/win/FileSystemWin.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebCoreArgumentCoderscpp">trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKDatabaseManagercpp">trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKDatabaseManagerh">trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebDatabaseManagerProxycpp">trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebDatabaseManagerProxyh">trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/ChangeLog        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-01-27 Alexey Proskuryakov <ap@apple.com>
+
+ Expose SQL database creation and modification times
+ https://bugs.webkit.org/show_bug.cgi?id=127728
+
+ Reviewed by Brady Eidson.
+
+ * platform/FileSystem.h:
+ * platform/posix/FileSystemPOSIX.cpp:
+ (WebCore::getFileCreationTime):
+ * platform/win/FileSystemWin.cpp:
+ (WebCore::getFileCreationTimeFromFindData):
+ (WebCore::getFileCreationTime):
+ Added functions to get file creation times. Not all OSes support that, but Darwin
+ and Windows do, as (I think) various BSD flavors.
+
+ * platform/gtk/FileSystemGtk.cpp: Added a stub for getFileCreationTime().
+
+ * platform/sql/SQLiteFileSystem.h:
+ * platform/sql/SQLiteFileSystem.cpp:
+ (WebCore::SQLiteFileSystem::databaseCreationTime):
+ (WebCore::SQLiteFileSystem::databaseModificationTime):
+ Expose it in the same strange manner other database file operations are.
+
+ * Modules/webdatabase/DatabaseDetails.h:
+ (WebCore::DatabaseDetails::DatabaseDetails):
+ (WebCore::DatabaseDetails::creationTime):
+ (WebCore::DatabaseDetails::modificationTime):
+ Added creation and modification times to DatabaseDetails.
+
+ * Modules/webdatabase/DatabaseManager.cpp:
+ (WebCore::DatabaseManager::ProposedDatabase::ProposedDatabase):
+ (WebCore::DatabaseManager::openDatabaseBackend):
+ ProposedDatabase is an unfortunate mechanism for communicating quota errors to the
+ client, we should really straighten it up. But for now, just leave the times uninitialized.
+
+ * Modules/webdatabase/DatabaseBackendBase.cpp: (WebCore::DatabaseBackendBase::details):
+ This code path is for handling quota errors, so there is no need to initialize most
+ of DatabaseDetails here as well.
+
+ * Modules/webdatabase/DatabaseTracker.cpp: (WebCore::DatabaseTracker::detailsForNameAndOrigin):
+ * Modules/webdatabase/DatabaseTracker.h:
+ Fill in database file times. Inlined and removed usageForDatabase function to
+ avoid rebuilding the path multiple times.
+
</ins><span class="cx"> 2014-01-28 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> Setting muted attribute on <video> element is not reflected in controls
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseBackendBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -455,7 +455,8 @@
</span><span class="cx">
</span><span class="cx"> DatabaseDetails DatabaseBackendBase::details() const
</span><span class="cx"> {
</span><del>- return DatabaseDetails(stringIdentifier(), displayName(), estimatedSize(), 0);
</del><ins>+ // 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);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool DatabaseBackendBase::getVersionFromDatabase(String& version, bool shouldCacheVersion)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseDetailsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseDetails.h        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -41,17 +41,21 @@
</span><span class="cx"> DatabaseDetails()
</span><span class="cx"> : m_expectedUsage(0)
</span><span class="cx"> , m_currentUsage(0)
</span><ins>+ , m_creationTime(0)
+ , m_modificationTime(0)
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> , m_threadID(std::this_thread::get_id())
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage)
</del><ins>+ DatabaseDetails(const String& databaseName, const String& displayName, unsigned long long expectedUsage, unsigned long long currentUsage, double creationTime, double modificationTime)
</ins><span class="cx"> : m_name(databaseName)
</span><span class="cx"> , m_displayName(displayName)
</span><span class="cx"> , m_expectedUsage(expectedUsage)
</span><span class="cx"> , m_currentUsage(currentUsage)
</span><ins>+ , m_creationTime(creationTime)
+ , m_modificationTime(modificationTime)
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> , m_threadID(std::this_thread::get_id())
</span><span class="cx"> #endif
</span><span class="lines">@@ -62,6 +66,8 @@
</span><span class="cx"> const String& displayName() const { return m_displayName; }
</span><span class="cx"> uint64_t expectedUsage() const { return m_expectedUsage; }
</span><span class="cx"> uint64_t currentUsage() const { return m_currentUsage; }
</span><ins>+ double creationTime() const { return m_creationTime; }
+ double modificationTime() const { return m_modificationTime; }
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> std::thread::id threadID() const { return m_threadID; }
</span><span class="cx"> #endif
</span><span class="lines">@@ -71,6 +77,8 @@
</span><span class="cx"> String m_displayName;
</span><span class="cx"> uint64_t m_expectedUsage;
</span><span class="cx"> uint64_t m_currentUsage;
</span><ins>+ double m_creationTime;
+ double m_modificationTime;
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> std::thread::id m_threadID;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> SecurityOrigin* origin, const String& name, const String& displayName, unsigned long estimatedSize)
</span><span class="cx"> : m_manager(manager)
</span><span class="cx"> , m_origin(origin->isolatedCopy())
</span><del>- , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0)
</del><ins>+ , m_details(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0, 0, 0)
</ins><span class="cx"> {
</span><span class="cx"> m_manager.addProposedDatabase(this);
</span><span class="cx"> }
</span><span class="lines">@@ -268,8 +268,7 @@
</span><span class="cx"> // one more try after if that is the case.
</span><span class="cx"> {
</span><span class="cx"> ProposedDatabase proposedDb(*this, context->securityOrigin(), name, displayName, estimatedSize);
</span><del>- databaseContext->databaseExceededQuota(name,
- DatabaseDetails(name.isolatedCopy(), displayName.isolatedCopy(), estimatedSize, 0));
</del><ins>+ databaseContext->databaseExceededQuota(name, proposedDb.details());
</ins><span class="cx"> }
</span><span class="cx"> error = DatabaseError::None;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseTrackercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -484,7 +484,10 @@
</span><span class="cx"> expectedUsage = statement.getColumnInt64(1);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return DatabaseDetails(name, displayName, expectedUsage, usageForDatabase(name, origin));
</del><ins>+ String path = fullPathForDatabase(origin, name, false);
+ if (path.isEmpty())
+ return DatabaseDetails(name, displayName, expectedUsage, 0, 0, 0);
+ return DatabaseDetails(name, displayName, expectedUsage, SQLiteFileSystem::getDatabaseFileSize(path), SQLiteFileSystem::databaseCreationTime(path), SQLiteFileSystem::databaseModificationTime(path));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DatabaseTracker::setDatabaseDetails(SecurityOrigin* origin, const String& name, const String& displayName, unsigned long estimatedSize)
</span><span class="lines">@@ -539,15 +542,6 @@
</span><span class="cx"> m_client->dispatchDidModifyDatabase(origin, name);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned long long DatabaseTracker::usageForDatabase(const String& name, SecurityOrigin* origin)
-{
- String path = fullPathForDatabase(origin, name, false);
- if (path.isEmpty())
- return 0;
-
- return SQLiteFileSystem::getDatabaseFileSize(path);
-}
-
</del><span class="cx"> void DatabaseTracker::doneCreatingDatabase(DatabaseBackendBase* database)
</span><span class="cx"> {
</span><span class="cx"> MutexLocker lockDatabase(m_databaseGuard);
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseTrackerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -90,7 +90,6 @@
</span><span class="cx">
</span><span class="cx"> DatabaseDetails detailsForNameAndOrigin(const String&, SecurityOrigin*);
</span><span class="cx">
</span><del>- unsigned long long usageForDatabase(const String&, SecurityOrigin*);
</del><span class="cx"> unsigned long long usageForOrigin(SecurityOrigin*);
</span><span class="cx"> unsigned long long quotaForOrigin(SecurityOrigin*);
</span><span class="cx"> void setQuota(SecurityOrigin*, unsigned long long);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformFileSystemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/FileSystem.h (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/FileSystem.h        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/platform/FileSystem.h        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -144,6 +144,7 @@
</span><span class="cx"> bool deleteEmptyDirectory(const String&);
</span><span class="cx"> bool getFileSize(const String&, long long& result);
</span><span class="cx"> bool getFileModificationTime(const String&, time_t& result);
</span><ins>+bool getFileCreationTime(const String&, time_t& result); // Not all platforms store file creation time.
</ins><span class="cx"> bool getFileMetadata(const String&, FileMetadata&);
</span><span class="cx"> String pathByAppendingComponent(const String& path, const String& component);
</span><span class="cx"> bool makeAllDirectories(const String& path);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkFileSystemGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -130,6 +130,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool getFileCreationTime(const String&, time_t&)
+{
+ // FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it?
+ return false;
+}
+
</ins><span class="cx"> bool getFileModificationTime(const String& path, time_t& modifiedTime)
</span><span class="cx"> {
</span><span class="cx"> GStatBuf statResult;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformposixFileSystemPOSIXcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -183,6 +183,28 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool getFileCreationTime(const String& path, time_t& result)
+{
+#if OS(DARWIN) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
+ CString fsRep = fileSystemRepresentation(path);
+
+ if (!fsRep.data() || fsRep.data()[0] == '\0')
+ return false;
+
+ struct stat fileInfo;
+
+ if (stat(fsRep.data(), &fileInfo))
+ return false;
+
+ result = fileInfo.st_birthtime;
+ return true;
+#else
+ UNUSED_PARAM(path);
+ UNUSED_PARAM(result);
+ return false;
+#endif
+}
+
</ins><span class="cx"> bool getFileModificationTime(const String& path, time_t& result)
</span><span class="cx"> {
</span><span class="cx"> CString fsRep = fileSystemRepresentation(path);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsqlSQLiteFileSystemcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -127,4 +127,16 @@
</span><span class="cx"> return getFileSize(fileName, size) ? size : 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+double SQLiteFileSystem::databaseCreationTime(const String& fileName)
+{
+ time_t time;
+ return getFileCreationTime(fileName, time) ? time : 0;
+}
+
+double SQLiteFileSystem::databaseModificationTime(const String& fileName)
+{
+ time_t time;
+ return getFileModificationTime(fileName, time) ? time : 0;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformsqlSQLiteFileSystemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/platform/sql/SQLiteFileSystem.h        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -106,10 +106,9 @@
</span><span class="cx"> static bool truncateDatabaseFile(sqlite3* database);
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- // Returns the size of the database file.
- //
- // fileName - The file name.
</del><span class="cx"> static long long getDatabaseFileSize(const String& fileName);
</span><ins>+ static double databaseCreationTime(const String& fileName);
+ static double databaseModificationTime(const String& fileName);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> // do not instantiate this class
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinFileSystemWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -68,6 +68,17 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void getFileCreationTimeFromFindData(const WIN32_FIND_DATAW& findData, time_t& time)
+{
+ ULARGE_INTEGER fileTime;
+ fileTime.HighPart = findData.ftCreationTime.dwHighDateTime;
+ fileTime.LowPart = findData.ftCreationTime.dwLowDateTime;
+
+ // Information about converting time_t to FileTime is available at http://msdn.microsoft.com/en-us/library/ms724228%28v=vs.85%29.aspx
+ time = fileTime.QuadPart / 10000000 - kSecondsFromFileTimeToTimet;
+}
+
+
</ins><span class="cx"> static void getFileModificationTimeFromFindData(const WIN32_FIND_DATAW& findData, time_t& time)
</span><span class="cx"> {
</span><span class="cx"> ULARGE_INTEGER fileTime;
</span><span class="lines">@@ -97,6 +108,16 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool getFileCreationTime(const String& path, time_t& time)
+{
+ WIN32_FIND_DATAW findData;
+ if (!getFindData(path, findData))
+ return false;
+
+ getFileCreationTimeFromFindData(findData, time);
+ return true;
+}
+
</ins><span class="cx"> bool getFileMetadata(const String& path, FileMetadata& metadata)
</span><span class="cx"> {
</span><span class="cx"> WIN32_FIND_DATAW findData;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-01-27 Alexey Proskuryakov <ap@apple.com>
+
+ Expose SQL database creation and modification times
+ https://bugs.webkit.org/show_bug.cgi?id=127728
+
+ Reviewed by Brady Eidson.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<DatabaseDetails>::encode):
+ (IPC::ArgumentCoder<DatabaseDetails>::decode):
+ Encode and decode new DatabaseDetails member variables.
+
+ * UIProcess/API/C/WKDatabaseManager.cpp:
+ (WKDatabaseManagerGetDatabaseDetailsCreationTimeKey):
+ (WKDatabaseManagerGetDatabaseDetailsModificationTimeKey):
+ * UIProcess/API/C/WKDatabaseManager.h:
+ Added new keys for database details.
+
+ * UIProcess/WebDatabaseManagerProxy.cpp:
+ (WebKit::WebDatabaseManagerProxy::databaseDetailsCreationTimeKey):
+ (WebKit::WebDatabaseManagerProxy::databaseDetailsModificationTimeKey):
+ (WebKit::WebDatabaseManagerProxy::didGetDatabasesByOrigin):
+ * UIProcess/WebDatabaseManagerProxy.h:
+ Set the new keys if times are valid.
+
</ins><span class="cx"> 2014-01-28 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> WebKit2 View Gestures (Swipe): Use CGSCaptureWindowsContentsToRect for now
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -915,6 +915,8 @@
</span><span class="cx"> encoder << details.displayName();
</span><span class="cx"> encoder << details.expectedUsage();
</span><span class="cx"> encoder << details.currentUsage();
</span><ins>+ encoder << details.creationTime();
+ encoder << details.modificationTime();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ArgumentCoder<DatabaseDetails>::decode(ArgumentDecoder& decoder, DatabaseDetails& details)
</span><span class="lines">@@ -934,8 +936,16 @@
</span><span class="cx"> uint64_t currentUsage;
</span><span class="cx"> if (!decoder.decode(currentUsage))
</span><span class="cx"> return false;
</span><del>-
- details = DatabaseDetails(name, displayName, expectedUsage, currentUsage);
</del><ins>+
+ double creationTime;
+ if (!decoder.decode(creationTime))
+ return false;
+
+ double modificationTime;
+ if (!decoder.decode(modificationTime))
+ return false;
+
+ details = DatabaseDetails(name, displayName, expectedUsage, currentUsage, creationTime, modificationTime);
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKDatabaseManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -120,6 +120,26 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+WKStringRef WKDatabaseManagerGetDatabaseDetailsCreationTimeKey()
+{
+#if ENABLE(SQL_DATABASE)
+ static API::String* key = API::String::create(WebDatabaseManagerProxy::databaseDetailsCreationTimeKey()).leakRef();
+ return toAPI(key);
+#else
+ return 0;
+#endif
+}
+
+WKStringRef WKDatabaseManagerGetDatabaseDetailsModificationTimeKey()
+{
+#if ENABLE(SQL_DATABASE)
+ static API::String* key = API::String::create(WebDatabaseManagerProxy::databaseDetailsModificationTimeKey()).leakRef();
+ return toAPI(key);
+#else
+ return 0;
+#endif
+}
+
</ins><span class="cx"> void WKDatabaseManagerSetClient(WKDatabaseManagerRef databaseManagerRef, const WKDatabaseManagerClientBase* wkClient)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(SQL_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKDatabaseManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKDatabaseManager.h        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -61,7 +61,13 @@
</span><span class="cx"> /* Value type: WKUInt64Ref */
</span><span class="cx"> WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsCurrentUsageKey();
</span><span class="cx">
</span><ins>+/* Value type: WKDoubleRef, seconds since January 1st, 1970 UTC */
+WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsCreationTimeKey();
</ins><span class="cx">
</span><ins>+/* Value type: WKDoubleRef, seconds since January 1st, 1970 UTC */
+WK_EXPORT WKStringRef WKDatabaseManagerGetDatabaseDetailsModificationTimeKey();
+
+
</ins><span class="cx"> // Database Manager Client
</span><span class="cx"> typedef void (*WKDatabaseManagerDidModifyOriginCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, const void *clientInfo);
</span><span class="cx"> typedef void (*WKDatabaseManagerDidModifyDatabaseCallback)(WKDatabaseManagerRef databaseManager, WKSecurityOriginRef origin, WKStringRef databaseIdentifier, const void *clientInfo);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebDatabaseManagerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.cpp        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -93,6 +93,18 @@
</span><span class="cx"> return key;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String WebDatabaseManagerProxy::databaseDetailsCreationTimeKey()
+{
+ static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsCreationTimeKey"));
+ return key;
+}
+
+String WebDatabaseManagerProxy::databaseDetailsModificationTimeKey()
+{
+ static NeverDestroyed<String> key(ASCIILiteral("WebDatabaseManagerDatabaseDetailsModificationTimeKey"));
+ return key;
+}
+
</ins><span class="cx"> PassRefPtr<WebDatabaseManagerProxy> WebDatabaseManagerProxy::create(WebContext* webContext)
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(new WebDatabaseManagerProxy(webContext));
</span><span class="lines">@@ -173,6 +185,10 @@
</span><span class="cx"> detailsMap.set(databaseDetailsDisplayNameKey(), API::String::create(databaseDetails.displayName()));
</span><span class="cx"> detailsMap.set(databaseDetailsExpectedUsageKey(), API::UInt64::create(databaseDetails.expectedUsage()));
</span><span class="cx"> detailsMap.set(databaseDetailsCurrentUsageKey(), API::UInt64::create(databaseDetails.currentUsage()));
</span><ins>+ if (databaseDetails.creationTime())
+ detailsMap.set(databaseDetailsCreationTimeKey(), API::Double::create(databaseDetails.creationTime()));
+ if (databaseDetails.modificationTime())
+ detailsMap.set(databaseDetailsModificationTimeKey(), API::Double::create(databaseDetails.modificationTime()));
</ins><span class="cx">
</span><span class="cx"> databases.uncheckedAppend(ImmutableDictionary::create(std::move(detailsMap)));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebDatabaseManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h (162942 => 162943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h        2014-01-28 17:55:17 UTC (rev 162942)
+++ trunk/Source/WebKit2/UIProcess/WebDatabaseManagerProxy.h        2014-01-28 18:18:47 UTC (rev 162943)
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx"> static String databaseDetailsDisplayNameKey();
</span><span class="cx"> static String databaseDetailsExpectedUsageKey();
</span><span class="cx"> static String databaseDetailsCurrentUsageKey();
</span><ins>+ static String databaseDetailsCreationTimeKey();
+ static String databaseDetailsModificationTimeKey();
</ins><span class="cx">
</span><span class="cx"> using API::Object::ref;
</span><span class="cx"> using API::Object::deref;
</span></span></pre>
</div>
</div>
</body>
</html>