Title: [109463] trunk/Source/WebCore
Revision
109463
Author
[email protected]
Date
2012-03-01 16:25:40 -0800 (Thu, 01 Mar 2012)

Log Message

Remove last ENABLED(INDEXED_DATABASE) ifdef from WebCore proper
https://bugs.webkit.org/show_bug.cgi?id=80061

Reviewed by Dimitri Glazkov.

This patch removes the last ENABLED(INDEXED_DATABASE) ifdef from
WebCore proper by moving the backend factory out of PageGroup and into
a supplement for PageGroup.  After this patch, we're ready to move the
IDB code into Modules.

* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::webkitIndexedDB):
* WebCore.gypi:
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore::assertIDBFactory):
* page/PageGroup.cpp:
(WebCore):
* page/PageGroup.h:
(PageGroup):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109462 => 109463)


--- trunk/Source/WebCore/ChangeLog	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/ChangeLog	2012-03-02 00:25:40 UTC (rev 109463)
@@ -1,3 +1,25 @@
+2012-03-01  Adam Barth  <[email protected]>
+
+        Remove last ENABLED(INDEXED_DATABASE) ifdef from WebCore proper
+        https://bugs.webkit.org/show_bug.cgi?id=80061
+
+        Reviewed by Dimitri Glazkov.
+
+        This patch removes the last ENABLED(INDEXED_DATABASE) ifdef from
+        WebCore proper by moving the backend factory out of PageGroup and into
+        a supplement for PageGroup.  After this patch, we're ready to move the
+        IDB code into Modules.
+
+        * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+        (WebCore::DOMWindowIndexedDatabase::webkitIndexedDB):
+        * WebCore.gypi:
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (WebCore::assertIDBFactory):
+        * page/PageGroup.cpp:
+        (WebCore):
+        * page/PageGroup.h:
+        (PageGroup):
+
 2012-03-01  Dale Curtis  <[email protected]>
 
         Remove deprecated FFmpeg build directories.

Modified: trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp (109462 => 109463)


--- trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp	2012-03-02 00:25:40 UTC (rev 109463)
@@ -10,7 +10,7 @@
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
@@ -32,7 +32,7 @@
 #include "Document.h"
 #include "IDBFactory.h"
 #include "Page.h"
-#include "PageGroup.h"
+#include "PageGroupIndexedDatabase.h"
 #include "SecurityOrigin.h"
 
 namespace WebCore {
@@ -83,7 +83,7 @@
         return 0;
 
     if (!m_idbFactory && m_window->isCurrentlyDisplayedInFrame())
-        m_idbFactory = IDBFactory::create(page->group().idbFactory());
+        m_idbFactory = IDBFactory::create(PageGroupIndexedDatabase::from(page->group())->factoryBackend());
     return m_idbFactory.get();
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h (109462 => 109463)


--- trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h	2012-03-02 00:25:40 UTC (rev 109463)
@@ -10,7 +10,7 @@
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE

Added: trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp (0 => 109463)


--- trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.cpp	2012-03-02 00:25:40 UTC (rev 109463)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+#include "config.h"
+#include "PageGroupIndexedDatabase.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBFactoryBackendInterface.h"
+#include "PageGroup.h"
+
+namespace WebCore {
+
+PageGroupIndexedDatabase::PageGroupIndexedDatabase()
+{
+}
+
+PageGroupIndexedDatabase::~PageGroupIndexedDatabase()
+{
+}
+
+PageGroupIndexedDatabase* PageGroupIndexedDatabase::from(PageGroup& group)
+{
+    DEFINE_STATIC_LOCAL(AtomicString, name, ("PageGroupIndexedDatabase"));
+    PageGroupIndexedDatabase* supplement = static_cast<PageGroupIndexedDatabase*>(Supplement<PageGroup>::from(&group, name));
+    if (!supplement) {
+        supplement = new PageGroupIndexedDatabase();
+        provideTo(&group, name, adoptPtr(supplement));
+    }
+    return supplement;
+}
+
+IDBFactoryBackendInterface* PageGroupIndexedDatabase::factoryBackend()
+{
+    // Do not add page setting based access control here since this object is shared by all pages in
+    // the group and having per-page controls is misleading.
+    if (!m_factoryBackend)
+        m_factoryBackend = IDBFactoryBackendInterface::create();
+    return m_factoryBackend.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)

Added: trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h (0 => 109463)


--- trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/indexeddb/PageGroupIndexedDatabase.h	2012-03-02 00:25:40 UTC (rev 109463)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+
+#ifndef PageGroupIndexedDatabase_h
+#define PageGroupIndexedDatabase_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "Supplementable.h"
+
+namespace WebCore {
+
+class IDBFactoryBackendInterface;
+class PageGroup;
+
+class PageGroupIndexedDatabase : public Supplement<PageGroup> {
+public:
+    virtual ~PageGroupIndexedDatabase();
+    static PageGroupIndexedDatabase* from(PageGroup&);
+
+    IDBFactoryBackendInterface* factoryBackend();
+
+private:
+    PageGroupIndexedDatabase();
+
+    RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // PageGroupIndexedDatabase_h

Modified: trunk/Source/WebCore/WebCore.gypi (109462 => 109463)


--- trunk/Source/WebCore/WebCore.gypi	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/WebCore.gypi	2012-03-02 00:25:40 UTC (rev 109463)
@@ -1296,6 +1296,8 @@
             'Modules/geolocation/NavigatorGeolocation.h',
             'Modules/indexeddb/DOMWindowIndexedDatabase.cpp',
             'Modules/indexeddb/DOMWindowIndexedDatabase.h',
+            'Modules/indexeddb/PageGroupIndexedDatabase.cpp',
+            'Modules/indexeddb/PageGroupIndexedDatabase.h',
             'Modules/intents/Intent.cpp',
             'Modules/intents/Intent.h',
             'Modules/intents/IntentRequest.cpp',

Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (109462 => 109463)


--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2012-03-02 00:25:40 UTC (rev 109463)
@@ -58,6 +58,7 @@
 #include "InstrumentingAgents.h"
 #include "Page.h"
 #include "PageGroup.h"
+#include "PageGroupIndexedDatabase.h"
 #include "SecurityOrigin.h"
 
 #include <wtf/Vector.h>
@@ -633,7 +634,7 @@
 static IDBFactoryBackendInterface* assertIDBFactory(ErrorString* errorString, Document* document)
 {
     Page* page = document ? document->page() : 0;
-    IDBFactoryBackendInterface* idbFactory = page ? page->group().idbFactory() : 0;
+    IDBFactoryBackendInterface* idbFactory = page ? PageGroupIndexedDatabase::from(page->group())->factoryBackend() : 0;
 
     if (!idbFactory)
         *errorString = "No IndexedDB factory for given frame found";

Modified: trunk/Source/WebCore/page/PageGroup.cpp (109462 => 109463)


--- trunk/Source/WebCore/page/PageGroup.cpp	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/page/PageGroup.cpp	2012-03-02 00:25:40 UTC (rev 109463)
@@ -261,17 +261,6 @@
     return m_localStorage.get();
 }
 
-#if ENABLE(INDEXED_DATABASE)
-IDBFactoryBackendInterface* PageGroup::idbFactory()
-{
-    // Do not add page setting based access control here since this object is shared by all pages in
-    // the group and having per-page controls is misleading.
-    if (!m_factoryBackend)
-        m_factoryBackend = IDBFactoryBackendInterface::create();
-    return m_factoryBackend.get();
-}
-#endif
-
 void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& source, const KURL& url,
                                      PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
                                      UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames)

Modified: trunk/Source/WebCore/page/PageGroup.h (109462 => 109463)


--- trunk/Source/WebCore/page/PageGroup.h	2012-03-02 00:25:13 UTC (rev 109462)
+++ trunk/Source/WebCore/page/PageGroup.h	2012-03-02 00:25:40 UTC (rev 109463)
@@ -29,6 +29,7 @@
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include "LinkHash.h"
+#include "Supplementable.h"
 #include "UserScript.h"
 #include "UserStyleSheet.h"
 #include <wtf/text/StringHash.h>
@@ -42,7 +43,7 @@
     class SecurityOrigin;
     class StorageNamespace;
 
-    class PageGroup {
+    class PageGroup : public Supplementable<PageGroup> {
         WTF_MAKE_NONCOPYABLE(PageGroup); WTF_MAKE_FAST_ALLOCATED;
     public:
         PageGroup(const String& name);
@@ -81,11 +82,6 @@
         StorageNamespace* localStorage();
         bool hasLocalStorage() { return m_localStorage; }
 
-#if ENABLE(INDEXED_DATABASE)
-        IDBFactoryBackendInterface* idbFactory();
-        bool hasIDBFactory() { return m_factoryBackend; }
-#endif
-
         void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&,
                                   PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
                                   UserScriptInjectionTime, UserContentInjectedFrames);
@@ -122,9 +118,6 @@
 
         unsigned m_identifier;
         RefPtr<StorageNamespace> m_localStorage;
-#if ENABLE(INDEXED_DATABASE)
-        RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
-#endif
 
         OwnPtr<UserScriptMap> m_userScripts;
         OwnPtr<UserStyleSheetMap> m_userStyleSheets;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to