Rename DatabaseManager::manager() to DatabaseManager::singleton()
https://bugs.webkit.org/show_bug.cgi?id=142054
Reviewed by Ryosuke Niwa.
Rename DatabaseManager::manager() to DatabaseManager::singleton() as
per coding style and use WTF::NeverDestroyed.
Source/WebCore:
* Modules/webdatabase/DOMWindowWebDatabase.cpp:
(WebCore::DOMWindowWebDatabase::openDatabase):
* Modules/webdatabase/DatabaseBackendBase.cpp:
(WebCore::DatabaseBackendBase::DatabaseBackendBase):
* Modules/webdatabase/DatabaseContext.cpp:
(WebCore::DatabaseContext::DatabaseContext):
(WebCore::DatabaseContext::~DatabaseContext):
(WebCore::DatabaseContext::stopDatabases):
(WebCore::DatabaseContext::databaseExceededQuota):
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::singleton):
(WebCore::DatabaseManager::manager): Deleted.
* Modules/webdatabase/DatabaseManager.h:
(WebCore::DatabaseManager::~DatabaseManager): Deleted.
* Modules/webdatabase/SQLTransactionClient.cpp:
(WebCore::SQLTransactionClient::didExceedQuota):
* history/PageCache.cpp:
(WebCore::logCanCacheFrameDecision):
(WebCore::PageCache::canCachePageContainingThisFrame):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):
Source/WebKit/mac:
* Storage/WebDatabaseManager.mm:
(-[WebDatabaseManager init]):
(-[WebDatabaseManager origins]):
(-[WebDatabaseManager databasesWithOrigin:]):
(-[WebDatabaseManager detailsForDatabase:withOrigin:]):
(-[WebDatabaseManager deleteAllDatabases]):
(-[WebDatabaseManager deleteOrigin:]):
(-[WebDatabaseManager deleteDatabase:withOrigin:]):
* Storage/WebDatabaseQuotaManager.mm:
(-[WebDatabaseQuotaManager usage]):
(-[WebDatabaseQuotaManager quota]):
(-[WebDatabaseQuotaManager setQuota:]):
* WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin usage]):
(-[WebSecurityOrigin quota]):
(-[WebSecurityOrigin setQuota:]):
* WebView/WebFrame.mm:
(-[WebFrame _cacheabilityDictionary]):
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
Source/WebKit/win:
* WebDatabaseManager.cpp:
(WebDatabaseManager::sharedWebDatabaseManager):
(WebDatabaseManager::origins):
(WebDatabaseManager::databasesWithOrigin):
(WebDatabaseManager::detailsForDatabase):
(WebDatabaseManager::deleteAllDatabases):
(WebDatabaseManager::deleteOrigin):
(WebDatabaseManager::deleteDatabase):
(WebDatabaseManager::setQuota):
(WebKitInitializeWebDatabasesIfNecessary):
* WebSecurityOrigin.cpp:
(WebSecurityOrigin::usage):
(WebSecurityOrigin::quota):
(WebSecurityOrigin::setQuota):
* WebView.cpp:
(WebView::notifyPreferencesChanged):
Source/WebKit2:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::exceededDatabaseQuota):
* WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
(WebKit::WebDatabaseManager::initialize):
(WebKit::WebDatabaseManager::getDatabasesByOrigin):
(WebKit::WebDatabaseManager::getDatabaseOrigins):
(WebKit::WebDatabaseManager::deleteDatabaseWithNameForOrigin):
(WebKit::WebDatabaseManager::deleteDatabasesForOrigin):
(WebKit::WebDatabaseManager::deleteAllDatabases):
(WebKit::WebDatabaseManager::setQuotaForOrigin):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@180704 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index a36294c..d134ef0 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2015-02-26 Chris Dumez <cdumez@apple.com>
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton()
+ https://bugs.webkit.org/show_bug.cgi?id=142054
+
+ Reviewed by Ryosuke Niwa.
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton() as
+ per coding style and use WTF::NeverDestroyed.
+
+ * Modules/webdatabase/DOMWindowWebDatabase.cpp:
+ (WebCore::DOMWindowWebDatabase::openDatabase):
+ * Modules/webdatabase/DatabaseBackendBase.cpp:
+ (WebCore::DatabaseBackendBase::DatabaseBackendBase):
+ * Modules/webdatabase/DatabaseContext.cpp:
+ (WebCore::DatabaseContext::DatabaseContext):
+ (WebCore::DatabaseContext::~DatabaseContext):
+ (WebCore::DatabaseContext::stopDatabases):
+ (WebCore::DatabaseContext::databaseExceededQuota):
+ * Modules/webdatabase/DatabaseManager.cpp:
+ (WebCore::DatabaseManager::singleton):
+ (WebCore::DatabaseManager::manager): Deleted.
+ * Modules/webdatabase/DatabaseManager.h:
+ (WebCore::DatabaseManager::~DatabaseManager): Deleted.
+ * Modules/webdatabase/SQLTransactionClient.cpp:
+ (WebCore::SQLTransactionClient::didExceedQuota):
+ * history/PageCache.cpp:
+ (WebCore::logCanCacheFrameDecision):
+ (WebCore::PageCache::canCachePageContainingThisFrame):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::stopLoading):
+
2015-02-26 Csaba Osztrogonác <ossy@webkit.org>
Fix the !ENABLE(GEOLOCATION) build after r180533
diff --git a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
index 50cd393..0154ba0 100644
--- a/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
+++ b/Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
@@ -43,7 +43,7 @@
return 0;
RefPtr<Database> database = 0;
- DatabaseManager& dbManager = DatabaseManager::manager();
+ DatabaseManager& dbManager = DatabaseManager::singleton();
DatabaseError error = DatabaseError::None;
if (dbManager.isAvailable() && window->document()->securityOrigin()->canAccessDatabase(window->document()->topOrigin())) {
database = dbManager.openDatabase(window->document(), name, version, displayName, estimatedSize, creationCallback, error);
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp b/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp
index a67e706..e6d7513 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp
+++ b/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp
@@ -229,7 +229,7 @@
hashSet->add(this);
}
- m_filename = DatabaseManager::manager().fullPathForDatabase(securityOrigin(), m_name);
+ m_filename = DatabaseManager::singleton().fullPathForDatabase(securityOrigin(), m_name);
}
DatabaseBackendBase::~DatabaseBackendBase()
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp b/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
index e5d9ef9..277639f 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
+++ b/Source/WebCore/Modules/webdatabase/DatabaseContext.cpp
@@ -110,9 +110,10 @@
// For debug accounting only. We must do this before we register the
// instance. The assertions assume this.
- DatabaseManager::manager().didConstructDatabaseContext();
+ auto& databaseManager = DatabaseManager::singleton();
+ databaseManager.didConstructDatabaseContext();
- DatabaseManager::manager().registerDatabaseContext(this);
+ databaseManager.registerDatabaseContext(this);
}
DatabaseContext::~DatabaseContext()
@@ -122,7 +123,7 @@
// For debug accounting only. We must call this last. The assertions assume
// this.
- DatabaseManager::manager().didDestructDatabaseContext();
+ DatabaseManager::singleton().didDestructDatabaseContext();
}
// This is called if the associated ScriptExecutionContext is destroyed while
@@ -185,7 +186,7 @@
bool DatabaseContext::stopDatabases(DatabaseTaskSynchronizer* synchronizer)
{
if (m_isRegistered) {
- DatabaseManager::manager().unregisterDatabaseContext(this);
+ DatabaseManager::singleton().unregisterDatabaseContext(this);
m_isRegistered = false;
}
@@ -231,7 +232,7 @@
ASSERT(m_scriptExecutionContext->isWorkerGlobalScope());
// FIXME: This needs a real implementation; this is a temporary solution for testing.
const unsigned long long defaultQuota = 5 * 1024 * 1024;
- DatabaseManager::manager().setQuota(m_scriptExecutionContext->securityOrigin(), defaultQuota);
+ DatabaseManager::singleton().setQuota(m_scriptExecutionContext->securityOrigin(), defaultQuota);
}
SecurityOrigin* DatabaseContext::securityOrigin() const
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
index 98a79ed..b037622 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
+++ b/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
@@ -41,6 +41,7 @@
#include "ScriptController.h"
#include "ScriptExecutionContext.h"
#include "SecurityOrigin.h"
+#include <wtf/NeverDestroyed.h>
namespace WebCore {
@@ -57,15 +58,10 @@
m_manager.removeProposedDatabase(this);
}
-DatabaseManager& DatabaseManager::manager()
+DatabaseManager& DatabaseManager::singleton()
{
- static DatabaseManager* dbManager = 0;
- // FIXME: The following is vulnerable to a race between threads. Need to
- // implement a thread safe on-first-use static initializer.
- if (!dbManager)
- dbManager = new DatabaseManager();
-
- return *dbManager;
+ static NeverDestroyed<DatabaseManager> instance;
+ return instance;
}
DatabaseManager::DatabaseManager()
diff --git a/Source/WebCore/Modules/webdatabase/DatabaseManager.h b/Source/WebCore/Modules/webdatabase/DatabaseManager.h
index 6c4e8c8..22257cb 100644
--- a/Source/WebCore/Modules/webdatabase/DatabaseManager.h
+++ b/Source/WebCore/Modules/webdatabase/DatabaseManager.h
@@ -51,8 +51,9 @@
class DatabaseManager {
WTF_MAKE_NONCOPYABLE(DatabaseManager); WTF_MAKE_FAST_ALLOCATED;
+ friend class WTF::NeverDestroyed<DatabaseManager>;
public:
- WEBCORE_EXPORT static DatabaseManager& manager();
+ WEBCORE_EXPORT static DatabaseManager& singleton();
WEBCORE_EXPORT void initialize(const String& databasePath);
WEBCORE_EXPORT void setClient(DatabaseManagerClient*);
@@ -121,7 +122,7 @@
};
DatabaseManager();
- ~DatabaseManager() { }
+ ~DatabaseManager() = delete;
// This gets a DatabaseContext for the specified ScriptExecutionContext if
// it already exist previously. Otherwise, it returns 0.
diff --git a/Source/WebCore/Modules/webdatabase/SQLTransactionClient.cpp b/Source/WebCore/Modules/webdatabase/SQLTransactionClient.cpp
index af43d10..188391b 100644
--- a/Source/WebCore/Modules/webdatabase/SQLTransactionClient.cpp
+++ b/Source/WebCore/Modules/webdatabase/SQLTransactionClient.cpp
@@ -49,9 +49,10 @@
bool SQLTransactionClient::didExceedQuota(DatabaseBackendBase* database)
{
ASSERT(database->databaseContext()->scriptExecutionContext()->isContextThread());
- unsigned long long currentQuota = DatabaseManager::manager().quotaForOrigin(database->securityOrigin());
+ auto& databaseManager = DatabaseManager::singleton();
+ unsigned long long currentQuota = databaseManager.quotaForOrigin(database->securityOrigin());
database->databaseContext()->databaseExceededQuota(database->stringIdentifier(), database->details());
- unsigned long long newQuota = DatabaseManager::manager().quotaForOrigin(database->securityOrigin());
+ unsigned long long newQuota = databaseManager.quotaForOrigin(database->securityOrigin());
return (newQuota > currentQuota);
}
diff --git a/Source/WebCore/history/PageCache.cpp b/Source/WebCore/history/PageCache.cpp
index 544ced5..b209e3f 100644
--- a/Source/WebCore/history/PageCache.cpp
+++ b/Source/WebCore/history/PageCache.cpp
@@ -153,7 +153,7 @@
logPageCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::httpsNoStoreKey());
rejectReasons |= 1 << IsHttpsAndCacheControlled;
}
- if (DatabaseManager::manager().hasOpenDatabases(frame.document())) {
+ if (DatabaseManager::singleton().hasOpenDatabases(frame.document())) {
PCLOG(" -Frame has open database handles");
logPageCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::hasOpenDatabasesKey());
rejectReasons |= 1 << HasDatabaseHandles;
@@ -319,7 +319,7 @@
&& !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
&& (!frameLoader.subframeLoader().containsPlugins() || frame.page()->settings().pageCacheSupportsPlugins())
&& !(frame.isMainFrame() && document->url().protocolIs("https") && documentLoader->response().cacheControlContainsNoStore())
- && !DatabaseManager::manager().hasOpenDatabases(document)
+ && !DatabaseManager::singleton().hasOpenDatabases(document)
&& frameLoader.history().currentItem()
&& !frameLoader.quickRedirectComing()
&& !documentLoader->isLoadingInAPISense()
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 96bf0fb..58702e8 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -488,7 +488,7 @@
doc->setReadyState(Document::Complete);
// FIXME: Should the DatabaseManager watch for something like ActiveDOMObject::stop() rather than being special-cased here?
- DatabaseManager::manager().stopDatabases(doc, 0);
+ DatabaseManager::singleton().stopDatabases(doc, 0);
}
// FIXME: This will cancel redirection timer, which really needs to be restarted when restoring the frame from b/f cache.
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 246e843..176d0f3 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,34 @@
+2015-02-26 Chris Dumez <cdumez@apple.com>
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton()
+ https://bugs.webkit.org/show_bug.cgi?id=142054
+
+ Reviewed by Ryosuke Niwa.
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton() as
+ per coding style and use WTF::NeverDestroyed.
+
+ * Storage/WebDatabaseManager.mm:
+ (-[WebDatabaseManager init]):
+ (-[WebDatabaseManager origins]):
+ (-[WebDatabaseManager databasesWithOrigin:]):
+ (-[WebDatabaseManager detailsForDatabase:withOrigin:]):
+ (-[WebDatabaseManager deleteAllDatabases]):
+ (-[WebDatabaseManager deleteOrigin:]):
+ (-[WebDatabaseManager deleteDatabase:withOrigin:]):
+ * Storage/WebDatabaseQuotaManager.mm:
+ (-[WebDatabaseQuotaManager usage]):
+ (-[WebDatabaseQuotaManager quota]):
+ (-[WebDatabaseQuotaManager setQuota:]):
+ * WebCoreSupport/WebSecurityOrigin.mm:
+ (-[WebSecurityOrigin usage]):
+ (-[WebSecurityOrigin quota]):
+ (-[WebSecurityOrigin setQuota:]):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _cacheabilityDictionary]):
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]):
+
2015-02-26 Myles C. Maxfield <mmaxfield@apple.com>
[Mac] [iOS] Parsing support for -apple-trailing-word
diff --git a/Source/WebKit/mac/Storage/WebDatabaseManager.mm b/Source/WebKit/mac/Storage/WebDatabaseManager.mm
index 9b9483f..b40af7b 100644
--- a/Source/WebKit/mac/Storage/WebDatabaseManager.mm
+++ b/Source/WebKit/mac/Storage/WebDatabaseManager.mm
@@ -74,7 +74,7 @@
WebPlatformStrategies::initializeIfNecessary();
- DatabaseManager& dbManager = DatabaseManager::manager();
+ DatabaseManager& dbManager = DatabaseManager::singleton();
// Set the database root path in WebCore
dbManager.initialize(databasesDirectoryPath());
@@ -88,7 +88,7 @@
- (NSArray *)origins
{
Vector<RefPtr<SecurityOrigin>> coreOrigins;
- DatabaseManager::manager().origins(coreOrigins);
+ DatabaseManager::singleton().origins(coreOrigins);
NSMutableArray *webOrigins = [[NSMutableArray alloc] initWithCapacity:coreOrigins.size()];
for (unsigned i = 0; i < coreOrigins.size(); ++i) {
@@ -103,7 +103,7 @@
- (NSArray *)databasesWithOrigin:(WebSecurityOrigin *)origin
{
Vector<String> nameVector;
- if (!DatabaseManager::manager().databaseNamesForOrigin([origin _core], nameVector))
+ if (!DatabaseManager::singleton().databaseNamesForOrigin([origin _core], nameVector))
return nil;
NSMutableArray *names = [[NSMutableArray alloc] initWithCapacity:nameVector.size()];
@@ -118,7 +118,7 @@
{
static id keys[3] = {WebDatabaseDisplayNameKey, WebDatabaseExpectedSizeKey, WebDatabaseUsageKey};
- DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(databaseIdentifier, [origin _core]);
+ DatabaseDetails details = DatabaseManager::singleton().detailsForNameAndOrigin(databaseIdentifier, [origin _core]);
if (details.name().isNull())
return nil;
@@ -132,7 +132,7 @@
- (void)deleteAllDatabases
{
- DatabaseManager::manager().deleteAllDatabases();
+ DatabaseManager::singleton().deleteAllDatabases();
#if PLATFORM(IOS)
// FIXME: This needs to be removed once DatabaseTrackers in multiple processes
// are in sync: <rdar://problem/9567500> Remove Website Data pane is not kept in sync with Safari
@@ -142,12 +142,12 @@
- (BOOL)deleteOrigin:(WebSecurityOrigin *)origin
{
- return DatabaseManager::manager().deleteOrigin([origin _core]);
+ return DatabaseManager::singleton().deleteOrigin([origin _core]);
}
- (BOOL)deleteDatabase:(NSString *)databaseIdentifier withOrigin:(WebSecurityOrigin *)origin
{
- return DatabaseManager::manager().deleteDatabase([origin _core], databaseIdentifier);
+ return DatabaseManager::singleton().deleteDatabase([origin _core], databaseIdentifier);
}
#if PLATFORM(IOS)
diff --git a/Source/WebKit/mac/Storage/WebDatabaseQuotaManager.mm b/Source/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
index c2ac2ae..b0c116d 100644
--- a/Source/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
+++ b/Source/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
@@ -49,12 +49,12 @@
- (unsigned long long)usage
{
- return DatabaseManager::manager().usageForOrigin([_origin _core]);
+ return DatabaseManager::singleton().usageForOrigin([_origin _core]);
}
- (unsigned long long)quota
{
- return DatabaseManager::manager().quotaForOrigin([_origin _core]);
+ return DatabaseManager::singleton().quotaForOrigin([_origin _core]);
}
// If the quota is set to a value lower than the current usage, that quota will
@@ -62,7 +62,7 @@
// prevent new data from being added to databases in that origin.
- (void)setQuota:(unsigned long long)quota
{
- DatabaseManager::manager().setQuota([_origin _core], quota);
+ DatabaseManager::singleton().setQuota([_origin _core], quota);
}
@end
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
index 68832ed..f4da169 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
@@ -179,17 +179,17 @@
- (unsigned long long)usage
{
- return DatabaseManager::manager().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+ return DatabaseManager::singleton().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
}
- (unsigned long long)quota
{
- return DatabaseManager::manager().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+ return DatabaseManager::singleton().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
}
- (void)setQuota:(unsigned long long)quota
{
- DatabaseManager::manager().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
+ DatabaseManager::singleton().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
}
@end
diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm
index e1f2a77..8c821ea 100644
--- a/Source/WebKit/mac/WebView/WebFrame.mm
+++ b/Source/WebKit/mac/WebView/WebFrame.mm
@@ -2093,7 +2093,7 @@
}
if (Document* document = _private->coreFrame->document()) {
- if (DatabaseManager::manager().hasOpenDatabases(document))
+ if (DatabaseManager::singleton().hasOpenDatabases(document))
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesDatabases];
if (!document->canSuspendActiveDOMObjects())
[result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameCanSuspendActiveDOMObjects];
diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm
index 5af8a1e..f036df4 100644
--- a/Source/WebKit/mac/WebView/WebView.mm
+++ b/Source/WebKit/mac/WebView/WebView.mm
@@ -2363,7 +2363,7 @@
settings.setQTKitEnabled([preferences isQTKitEnabled]);
#endif // PLATFORM(MAC)
- DatabaseManager::manager().setIsAvailable([preferences databasesEnabled]);
+ DatabaseManager::singleton().setIsAvailable([preferences databasesEnabled]);
#if ENABLE(MEDIA_SOURCE)
settings.setMediaSourceEnabled([preferences mediaSourceEnabled]);
diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog
index e5039ba..1a651f6 100644
--- a/Source/WebKit/win/ChangeLog
+++ b/Source/WebKit/win/ChangeLog
@@ -1,3 +1,30 @@
+2015-02-26 Chris Dumez <cdumez@apple.com>
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton()
+ https://bugs.webkit.org/show_bug.cgi?id=142054
+
+ Reviewed by Ryosuke Niwa.
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton() as
+ per coding style and use WTF::NeverDestroyed.
+
+ * WebDatabaseManager.cpp:
+ (WebDatabaseManager::sharedWebDatabaseManager):
+ (WebDatabaseManager::origins):
+ (WebDatabaseManager::databasesWithOrigin):
+ (WebDatabaseManager::detailsForDatabase):
+ (WebDatabaseManager::deleteAllDatabases):
+ (WebDatabaseManager::deleteOrigin):
+ (WebDatabaseManager::deleteDatabase):
+ (WebDatabaseManager::setQuota):
+ (WebKitInitializeWebDatabasesIfNecessary):
+ * WebSecurityOrigin.cpp:
+ (WebSecurityOrigin::usage):
+ (WebSecurityOrigin::quota):
+ (WebSecurityOrigin::setQuota):
+ * WebView.cpp:
+ (WebView::notifyPreferencesChanged):
+
2015-02-25 Brent Fulgham <bfulgham@apple.com>
[Win] Use WEBCORE_EXPORT instead of Definition file
diff --git a/Source/WebKit/win/WebDatabaseManager.cpp b/Source/WebKit/win/WebDatabaseManager.cpp
index 0eeab17..7004367 100644
--- a/Source/WebKit/win/WebDatabaseManager.cpp
+++ b/Source/WebKit/win/WebDatabaseManager.cpp
@@ -201,7 +201,7 @@
{
if (!s_sharedWebDatabaseManager) {
s_sharedWebDatabaseManager.adoptRef(WebDatabaseManager::createInstance());
- DatabaseManager::manager().setClient(s_sharedWebDatabaseManager.get());
+ DatabaseManager::singleton().setClient(s_sharedWebDatabaseManager.get());
}
return s_sharedWebDatabaseManager.copyRefTo(result);
@@ -219,7 +219,7 @@
return E_FAIL;
Vector<RefPtr<SecurityOrigin> > origins;
- DatabaseManager::manager().origins(origins);
+ DatabaseManager::singleton().origins(origins);
COMPtr<COMEnumVariant<Vector<RefPtr<SecurityOrigin> > > > enumVariant(AdoptCOM, COMEnumVariant<Vector<RefPtr<SecurityOrigin> > >::adopt(origins));
*result = enumVariant.leakRef();
@@ -243,7 +243,7 @@
return E_FAIL;
Vector<String> databaseNames;
- DatabaseManager::manager().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);
+ DatabaseManager::singleton().databaseNamesForOrigin(webSecurityOrigin->securityOrigin(), databaseNames);
COMPtr<COMEnumVariant<Vector<String> > > enumVariant(AdoptCOM, COMEnumVariant<Vector<String> >::adopt(databaseNames));
@@ -268,7 +268,7 @@
if (!webSecurityOrigin)
return E_FAIL;
- DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),
+ DatabaseDetails details = DatabaseManager::singleton().detailsForNameAndOrigin(String(databaseName, SysStringLen(databaseName)),
webSecurityOrigin->securityOrigin());
if (details.name().isNull())
@@ -283,7 +283,7 @@
if (this != s_sharedWebDatabaseManager)
return E_FAIL;
- DatabaseManager::manager().deleteAllDatabases();
+ DatabaseManager::singleton().deleteAllDatabases();
return S_OK;
}
@@ -301,7 +301,7 @@
if (!webSecurityOrigin)
return E_FAIL;
- DatabaseManager::manager().deleteOrigin(webSecurityOrigin->securityOrigin());
+ DatabaseManager::singleton().deleteOrigin(webSecurityOrigin->securityOrigin());
return S_OK;
}
@@ -323,7 +323,7 @@
if (!webSecurityOrigin)
return E_FAIL;
- DatabaseManager::manager().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));
+ DatabaseManager::singleton().deleteDatabase(webSecurityOrigin->securityOrigin(), String(databaseName, SysStringLen(databaseName)));
return S_OK;
}
@@ -380,7 +380,7 @@
if (this != s_sharedWebDatabaseManager)
return E_FAIL;
- DatabaseManager::manager().setQuota(SecurityOrigin::createFromString(origin).ptr(), quota);
+ DatabaseManager::singleton().setQuota(SecurityOrigin::createFromString(origin).ptr(), quota);
return S_OK;
}
@@ -421,7 +421,7 @@
if (initialized)
return;
- WebCore::DatabaseManager::manager().initialize(databasesDirectory());
+ WebCore::DatabaseManager::singleton().initialize(databasesDirectory());
initialized = true;
}
diff --git a/Source/WebKit/win/WebSecurityOrigin.cpp b/Source/WebKit/win/WebSecurityOrigin.cpp
index 7dff229..7d4a3b2 100644
--- a/Source/WebKit/win/WebSecurityOrigin.cpp
+++ b/Source/WebKit/win/WebSecurityOrigin.cpp
@@ -126,7 +126,7 @@
if (!result)
return E_POINTER;
- *result = DatabaseManager::manager().usageForOrigin(m_securityOrigin.get());
+ *result = DatabaseManager::singleton().usageForOrigin(m_securityOrigin.get());
return S_OK;
}
@@ -136,13 +136,13 @@
if (!result)
return E_POINTER;
- *result = DatabaseManager::manager().quotaForOrigin(m_securityOrigin.get());
+ *result = DatabaseManager::singleton().quotaForOrigin(m_securityOrigin.get());
return S_OK;
}
HRESULT WebSecurityOrigin::setQuota(/* [in] */ unsigned long long quota)
{
- DatabaseManager::manager().setQuota(m_securityOrigin.get(), quota);
+ DatabaseManager::singleton().setQuota(m_securityOrigin.get(), quota);
return S_OK;
}
diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp
index 55ab7d3..af63d2d 100644
--- a/Source/WebKit/win/WebView.cpp
+++ b/Source/WebKit/win/WebView.cpp
@@ -4996,7 +4996,7 @@
hr = prefsPrivate->databasesEnabled(&enabled);
if (FAILED(hr))
return hr;
- DatabaseManager::manager().setIsAvailable(enabled);
+ DatabaseManager::singleton().setIsAvailable(enabled);
hr = prefsPrivate->localStorageEnabled(&enabled);
if (FAILED(hr))
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 9b3d3f4..f9ada27 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,26 @@
+2015-02-26 Chris Dumez <cdumez@apple.com>
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton()
+ https://bugs.webkit.org/show_bug.cgi?id=142054
+
+ Reviewed by Ryosuke Niwa.
+
+ Rename DatabaseManager::manager() to DatabaseManager::singleton() as
+ per coding style and use WTF::NeverDestroyed.
+
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::exceededDatabaseQuota):
+ * WebProcess/WebCoreSupport/WebDatabaseManager.cpp:
+ (WebKit::WebDatabaseManager::initialize):
+ (WebKit::WebDatabaseManager::getDatabasesByOrigin):
+ (WebKit::WebDatabaseManager::getDatabaseOrigins):
+ (WebKit::WebDatabaseManager::deleteDatabaseWithNameForOrigin):
+ (WebKit::WebDatabaseManager::deleteDatabasesForOrigin):
+ (WebKit::WebDatabaseManager::deleteAllDatabases):
+ (WebKit::WebDatabaseManager::setQuotaForOrigin):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+
2015-02-26 Myles C. Maxfield <mmaxfield@apple.com>
[Mac] [iOS] Parsing support for -apple-trailing-word
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
index a50a9ac..324821f 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -689,7 +689,7 @@
SecurityOrigin* origin = frame->document()->securityOrigin();
- DatabaseManager& dbManager = DatabaseManager::manager();
+ DatabaseManager& dbManager = DatabaseManager::singleton();
uint64_t currentQuota = dbManager.quotaForOrigin(origin);
uint64_t currentOriginUsage = dbManager.usageForOrigin(origin);
uint64_t newQuota = 0;
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
index af71109..92522e1 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebDatabaseManager.cpp
@@ -53,8 +53,9 @@
void WebDatabaseManager::initialize(const WebProcessCreationParameters& parameters)
{
- DatabaseManager::manager().initialize(parameters.webSQLDatabaseDirectory);
- DatabaseManager::manager().setClient(this);
+ auto& databaseManager = DatabaseManager::singleton();
+ databaseManager.initialize(parameters.webSQLDatabaseDirectory);
+ databaseManager.setClient(this);
}
void WebDatabaseManager::getDatabasesByOrigin(uint64_t callbackID) const
@@ -63,8 +64,9 @@
// to get both the origins and the Vector of DatabaseDetails for each origin in one
// shot. That would avoid taking the numerous locks this requires.
+ auto& databaseManager = DatabaseManager::singleton();
Vector<RefPtr<SecurityOrigin>> origins;
- DatabaseManager::manager().origins(origins);
+ databaseManager.origins(origins);
Vector<OriginAndDatabases> originAndDatabasesVector;
originAndDatabasesVector.reserveInitialCapacity(origins.size());
@@ -73,13 +75,13 @@
OriginAndDatabases originAndDatabases;
Vector<String> nameVector;
- if (!DatabaseManager::manager().databaseNamesForOrigin(origins[i].get(), nameVector))
+ if (!databaseManager.databaseNamesForOrigin(origins[i].get(), nameVector))
continue;
Vector<DatabaseDetails> detailsVector;
detailsVector.reserveInitialCapacity(nameVector.size());
for (size_t j = 0; j < nameVector.size(); j++) {
- DatabaseDetails details = DatabaseManager::manager().detailsForNameAndOrigin(nameVector[j], origins[i].get());
+ DatabaseDetails details = databaseManager.detailsForNameAndOrigin(nameVector[j], origins[i].get());
if (details.name().isNull())
continue;
@@ -90,8 +92,8 @@
continue;
originAndDatabases.originIdentifier = origins[i]->databaseIdentifier();
- originAndDatabases.originQuota = DatabaseManager::manager().quotaForOrigin(origins[i].get());
- originAndDatabases.originUsage = DatabaseManager::manager().usageForOrigin(origins[i].get());
+ originAndDatabases.originQuota = databaseManager.quotaForOrigin(origins[i].get());
+ originAndDatabases.originUsage = databaseManager.usageForOrigin(origins[i].get());
originAndDatabases.databases.swap(detailsVector);
originAndDatabasesVector.append(originAndDatabases);
}
@@ -102,7 +104,7 @@
void WebDatabaseManager::getDatabaseOrigins(uint64_t callbackID) const
{
Vector<RefPtr<SecurityOrigin>> origins;
- DatabaseManager::manager().origins(origins);
+ DatabaseManager::singleton().origins(origins);
size_t numOrigins = origins.size();
@@ -118,7 +120,7 @@
if (!origin)
return;
- DatabaseManager::manager().deleteDatabase(origin.get(), databaseIdentifier);
+ DatabaseManager::singleton().deleteDatabase(origin.get(), databaseIdentifier);
}
void WebDatabaseManager::deleteDatabasesForOrigin(const String& originIdentifier) const
@@ -127,12 +129,12 @@
if (!origin)
return;
- DatabaseManager::manager().deleteOrigin(origin.get());
+ DatabaseManager::singleton().deleteOrigin(origin.get());
}
void WebDatabaseManager::deleteAllDatabases() const
{
- DatabaseManager::manager().deleteAllDatabases();
+ DatabaseManager::singleton().deleteAllDatabases();
}
void WebDatabaseManager::setQuotaForOrigin(const String& originIdentifier, unsigned long long quota) const
@@ -145,7 +147,7 @@
if (!origin)
return;
- DatabaseManager::manager().setQuota(origin.get(), quota);
+ DatabaseManager::singleton().setQuota(origin.get(), quota);
}
void WebDatabaseManager::dispatchDidModifyOrigin(SecurityOrigin* origin)
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 870ed92..d1b8b7d 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -2714,7 +2714,7 @@
settings.setInteractiveFormValidationEnabled(store.getBoolValueForKey(WebPreferencesKey::interactiveFormValidationEnabledKey()));
settings.setSpatialNavigationEnabled(store.getBoolValueForKey(WebPreferencesKey::spatialNavigationEnabledKey()));
- DatabaseManager::manager().setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
+ DatabaseManager::singleton().setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
#if ENABLE(FULLSCREEN_API)
settings.setFullScreenEnabled(store.getBoolValueForKey(WebPreferencesKey::fullScreenEnabledKey()));