<!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>[187996] trunk/Source/WebCore</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/187996">187996</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2015-08-05 15:58:52 -0700 (Wed, 05 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move some more DatabaseBackendBase functions to Database
https://bugs.webkit.org/show_bug.cgi?id=147702

Reviewed by Tim Horton.

* Modules/webdatabase/Database.cpp:
(WebCore::formatErrorMessage):
(WebCore::Database::disableAuthorizer):
(WebCore::Database::enableAuthorizer):
(WebCore::Database::setAuthorizerPermissions):
(WebCore::Database::lastActionChangedDatabase):
(WebCore::Database::lastActionWasInsert):
(WebCore::Database::resetDeletes):
(WebCore::Database::hadDeletes):
(WebCore::Database::resetAuthorizer):
(WebCore::Database::incrementalVacuumIfNeeded):
* Modules/webdatabase/Database.h:
* Modules/webdatabase/DatabaseBackendBase.cpp:
(WebCore::DatabaseBackendBase::disableAuthorizer): Deleted.
(WebCore::DatabaseBackendBase::enableAuthorizer): Deleted.
(WebCore::DatabaseBackendBase::setAuthorizerPermissions): Deleted.
(WebCore::DatabaseBackendBase::lastActionChangedDatabase): Deleted.
(WebCore::DatabaseBackendBase::lastActionWasInsert): Deleted.
(WebCore::DatabaseBackendBase::resetDeletes): Deleted.
(WebCore::DatabaseBackendBase::hadDeletes): Deleted.
(WebCore::DatabaseBackendBase::resetAuthorizer): Deleted.
(WebCore::DatabaseBackendBase::incrementalVacuumIfNeeded): Deleted.
* Modules/webdatabase/DatabaseBackendBase.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabasecpp">trunk/Source/WebCore/Modules/webdatabase/Database.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseh">trunk/Source/WebCore/Modules/webdatabase/Database.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseBackendBasecpp">trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebdatabaseDatabaseBackendBaseh">trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (187995 => 187996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-05 22:57:52 UTC (rev 187995)
+++ trunk/Source/WebCore/ChangeLog        2015-08-05 22:58:52 UTC (rev 187996)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2015-08-05  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Move some more DatabaseBackendBase functions to Database
+        https://bugs.webkit.org/show_bug.cgi?id=147702
+
+        Reviewed by Tim Horton.
+
+        * Modules/webdatabase/Database.cpp:
+        (WebCore::formatErrorMessage):
+        (WebCore::Database::disableAuthorizer):
+        (WebCore::Database::enableAuthorizer):
+        (WebCore::Database::setAuthorizerPermissions):
+        (WebCore::Database::lastActionChangedDatabase):
+        (WebCore::Database::lastActionWasInsert):
+        (WebCore::Database::resetDeletes):
+        (WebCore::Database::hadDeletes):
+        (WebCore::Database::resetAuthorizer):
+        (WebCore::Database::incrementalVacuumIfNeeded):
+        * Modules/webdatabase/Database.h:
+        * Modules/webdatabase/DatabaseBackendBase.cpp:
+        (WebCore::DatabaseBackendBase::disableAuthorizer): Deleted.
+        (WebCore::DatabaseBackendBase::enableAuthorizer): Deleted.
+        (WebCore::DatabaseBackendBase::setAuthorizerPermissions): Deleted.
+        (WebCore::DatabaseBackendBase::lastActionChangedDatabase): Deleted.
+        (WebCore::DatabaseBackendBase::lastActionWasInsert): Deleted.
+        (WebCore::DatabaseBackendBase::resetDeletes): Deleted.
+        (WebCore::DatabaseBackendBase::hadDeletes): Deleted.
+        (WebCore::DatabaseBackendBase::resetAuthorizer): Deleted.
+        (WebCore::DatabaseBackendBase::incrementalVacuumIfNeeded): Deleted.
+        * Modules/webdatabase/DatabaseBackendBase.h:
+
</ins><span class="cx"> 2015-08-05  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Frame flattening] Return early when child RenderView is not available.
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/Database.cpp (187995 => 187996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/Database.cpp        2015-08-05 22:57:52 UTC (rev 187995)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.cpp        2015-08-05 22:58:52 UTC (rev 187996)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ChangeVersionData.h&quot;
</span><span class="cx"> #include &quot;ChangeVersionWrapper.h&quot;
</span><ins>+#include &quot;DatabaseAuthorizer.h&quot;
</ins><span class="cx"> #include &quot;DatabaseCallback.h&quot;
</span><span class="cx"> #include &quot;DatabaseContext.h&quot;
</span><span class="cx"> #include &quot;DatabaseManager.h&quot;
</span><span class="lines">@@ -45,6 +46,7 @@
</span><span class="cx"> #include &quot;SQLTransaction.h&quot;
</span><span class="cx"> #include &quot;SQLTransactionCallback.h&quot;
</span><span class="cx"> #include &quot;SQLTransactionErrorCallback.h&quot;
</span><ins>+#include &quot;SQLiteDatabaseTracker.h&quot;
</ins><span class="cx"> #include &quot;SQLiteStatement.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &quot;SecurityOrigin.h&quot;
</span><span class="lines">@@ -54,12 +56,13 @@
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-#include &quot;SQLiteDatabaseTracker.h&quot;
-#endif
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+static String formatErrorMessage(const char* message, int sqliteErrorCode, const char* sqliteErrorMessage)
+{
+    return String::format(&quot;%s (%d %s)&quot;, message, sqliteErrorCode, sqliteErrorMessage);
+}
+
</ins><span class="cx"> Database::Database(PassRefPtr&lt;DatabaseContext&gt; databaseContext, const String&amp; name, const String&amp; expectedVersion, const String&amp; displayName, unsigned long estimatedSize)
</span><span class="cx">     : DatabaseBackendBase(databaseContext.get(), name, expectedVersion, displayName, estimatedSize)
</span><span class="cx">     , m_transactionInProgress(false)
</span><span class="lines">@@ -260,6 +263,54 @@
</span><span class="cx">     runTransaction(callback, errorCallback, successCallback, true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Database::disableAuthorizer()
+{
+    ASSERT(m_databaseAuthorizer);
+    m_databaseAuthorizer-&gt;disable();
+}
+
+void Database::enableAuthorizer()
+{
+    ASSERT(m_databaseAuthorizer);
+    m_databaseAuthorizer-&gt;enable();
+}
+
+void Database::setAuthorizerPermissions(int permissions)
+{
+    ASSERT(m_databaseAuthorizer);
+    m_databaseAuthorizer-&gt;setPermissions(permissions);
+}
+
+bool Database::lastActionChangedDatabase()
+{
+    ASSERT(m_databaseAuthorizer);
+    return m_databaseAuthorizer-&gt;lastActionChangedDatabase();
+}
+
+bool Database::lastActionWasInsert()
+{
+    ASSERT(m_databaseAuthorizer);
+    return m_databaseAuthorizer-&gt;lastActionWasInsert();
+}
+
+void Database::resetDeletes()
+{
+    ASSERT(m_databaseAuthorizer);
+    m_databaseAuthorizer-&gt;resetDeletes();
+}
+
+bool Database::hadDeletes()
+{
+    ASSERT(m_databaseAuthorizer);
+    return m_databaseAuthorizer-&gt;hadDeletes();
+}
+
+void Database::resetAuthorizer()
+{
+    if (m_databaseAuthorizer)
+        m_databaseAuthorizer-&gt;reset();
+}
+
</ins><span class="cx"> void Database::runTransaction(RefPtr&lt;SQLTransactionCallback&gt;&amp;&amp; callback, RefPtr&lt;SQLTransactionErrorCallback&gt;&amp;&amp; errorCallback, RefPtr&lt;VoidCallback&gt;&amp;&amp; successCallback, bool readOnly, const ChangeVersionData* changeVersionData)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;SQLTransaction&gt; transaction = SQLTransaction::create(*this, WTF::move(callback), WTF::move(successCallback), errorCallback.copyRef(), readOnly);
</span><span class="lines">@@ -310,6 +361,19 @@
</span><span class="cx">     return tableNames;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Database::incrementalVacuumIfNeeded()
+{
+    SQLiteTransactionInProgressAutoCounter transactionCounter;
+
+    int64_t freeSpaceSize = m_sqliteDatabase.freeSpaceSize();
+    int64_t totalSize = m_sqliteDatabase.totalSize();
+    if (totalSize &lt;= 10 * freeSpaceSize) {
+        int result = m_sqliteDatabase.runIncrementalVacuumCommand();
+        if (result != SQLITE_OK)
+            logErrorMessage(formatErrorMessage(&quot;error vacuuming database&quot;, result, m_sqliteDatabase.lastErrorMsg()));
+    }
+}
+
</ins><span class="cx"> void Database::logErrorMessage(const String&amp; message)
</span><span class="cx"> {
</span><span class="cx">     m_scriptExecutionContext-&gt;addConsoleMessage(MessageSource::Storage, MessageLevel::Error, message);
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/Database.h (187995 => 187996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/Database.h        2015-08-05 22:57:52 UTC (rev 187995)
+++ trunk/Source/WebCore/Modules/webdatabase/Database.h        2015-08-05 22:58:52 UTC (rev 187996)
</span><span class="lines">@@ -77,6 +77,15 @@
</span><span class="cx">     void readTransaction(PassRefPtr&lt;SQLTransactionCallback&gt;, PassRefPtr&lt;SQLTransactionErrorCallback&gt;, PassRefPtr&lt;VoidCallback&gt; successCallback);
</span><span class="cx"> 
</span><span class="cx">     // Internal engine support
</span><ins>+    void disableAuthorizer();
+    void enableAuthorizer();
+    void setAuthorizerPermissions(int);
+    bool lastActionChangedDatabase();
+    bool lastActionWasInsert();
+    void resetDeletes();
+    bool hadDeletes();
+    void resetAuthorizer();
+
</ins><span class="cx">     DatabaseContext* databaseContext() const { return m_databaseContext.get(); }
</span><span class="cx"> 
</span><span class="cx">     ScriptExecutionContext* scriptExecutionContext() { return m_scriptExecutionContext.get(); }
</span><span class="lines">@@ -94,6 +103,8 @@
</span><span class="cx">     virtual bool performOpenAndVerify(bool setVersionInNewDatabase, DatabaseError&amp;, String&amp; errorMessage);
</span><span class="cx">     Vector&lt;String&gt; performGetTableNames();
</span><span class="cx"> 
</span><ins>+    void incrementalVacuumIfNeeded();
+
</ins><span class="cx"> private:
</span><span class="cx">     Database(PassRefPtr&lt;DatabaseContext&gt;, const String&amp; name, const String&amp; expectedVersion, const String&amp; displayName, unsigned long estimatedSize);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseBackendBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp (187995 => 187996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp        2015-08-05 22:57:52 UTC (rev 187995)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp        2015-08-05 22:58:52 UTC (rev 187996)
</span><span class="lines">@@ -520,70 +520,9 @@
</span><span class="cx">     return getVersionFromDatabase(actualVersion, true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DatabaseBackendBase::disableAuthorizer()
-{
-    ASSERT(m_databaseAuthorizer);
-    m_databaseAuthorizer-&gt;disable();
-}
-
-void DatabaseBackendBase::enableAuthorizer()
-{
-    ASSERT(m_databaseAuthorizer);
-    m_databaseAuthorizer-&gt;enable();
-}
-
-void DatabaseBackendBase::setAuthorizerPermissions(int permissions)
-{
-    ASSERT(m_databaseAuthorizer);
-    m_databaseAuthorizer-&gt;setPermissions(permissions);
-}
-
-bool DatabaseBackendBase::lastActionChangedDatabase()
-{
-    ASSERT(m_databaseAuthorizer);
-    return m_databaseAuthorizer-&gt;lastActionChangedDatabase();
-}
-
-bool DatabaseBackendBase::lastActionWasInsert()
-{
-    ASSERT(m_databaseAuthorizer);
-    return m_databaseAuthorizer-&gt;lastActionWasInsert();
-}
-
-void DatabaseBackendBase::resetDeletes()
-{
-    ASSERT(m_databaseAuthorizer);
-    m_databaseAuthorizer-&gt;resetDeletes();
-}
-
-bool DatabaseBackendBase::hadDeletes()
-{
-    ASSERT(m_databaseAuthorizer);
-    return m_databaseAuthorizer-&gt;hadDeletes();
-}
-
-void DatabaseBackendBase::resetAuthorizer()
-{
-    if (m_databaseAuthorizer)
-        m_databaseAuthorizer-&gt;reset();
-}
-
</del><span class="cx"> unsigned long long DatabaseBackendBase::maximumSize() const
</span><span class="cx"> {
</span><span class="cx">     return DatabaseTracker::tracker().getMaxSizeForDatabase(static_cast&lt;const Database*&gt;(this));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DatabaseBackendBase::incrementalVacuumIfNeeded()
-{
-    SQLiteTransactionInProgressAutoCounter transactionCounter;
-
-    int64_t freeSpaceSize = m_sqliteDatabase.freeSpaceSize();
-    int64_t totalSize = m_sqliteDatabase.totalSize();
-    if (totalSize &lt;= 10 * freeSpaceSize) {
-        int result = m_sqliteDatabase.runIncrementalVacuumCommand();
-        if (result != SQLITE_OK)
-            m_frontend-&gt;logErrorMessage(formatErrorMessage(&quot;error vacuuming database&quot;, result, m_sqliteDatabase.lastErrorMsg()));
-    }
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebdatabaseDatabaseBackendBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.h (187995 => 187996)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.h        2015-08-05 22:57:52 UTC (rev 187995)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.h        2015-08-05 22:58:52 UTC (rev 187996)
</span><span class="lines">@@ -64,17 +64,7 @@
</span><span class="cx">     SQLiteDatabase&amp; sqliteDatabase() { return m_sqliteDatabase; }
</span><span class="cx"> 
</span><span class="cx">     unsigned long long maximumSize() const;
</span><del>-    void incrementalVacuumIfNeeded();
</del><span class="cx"> 
</span><del>-    void disableAuthorizer();
-    void enableAuthorizer();
-    void setAuthorizerPermissions(int permissions);
-    bool lastActionChangedDatabase();
-    bool lastActionWasInsert();
-    void resetDeletes();
-    bool hadDeletes();
-    void resetAuthorizer();
-
</del><span class="cx">     DatabaseContext* databaseContext() const { return m_databaseContext.get(); }
</span><span class="cx">     void setFrontend(Database* frontend) { m_frontend = frontend; }
</span><span class="cx"> 
</span><span class="lines">@@ -116,7 +106,6 @@
</span><span class="cx"> 
</span><span class="cx">     Database* m_frontend;
</span><span class="cx"> 
</span><del>-private:
</del><span class="cx">     DatabaseGuid m_guid;
</span><span class="cx">     bool m_opened;
</span><span class="cx">     bool m_new;
</span></span></pre>
</div>
</div>

</body>
</html>