Title: [140952] trunk/Source/WebKit2
Revision
140952
Author
[email protected]
Date
2013-01-28 01:02:32 -0800 (Mon, 28 Jan 2013)

Log Message

[EFL][WK2] Rely more on C API in ewk_favicon_database
https://bugs.webkit.org/show_bug.cgi?id=108035

Reviewed by Benjamin Poulain.

Rely less on internal C++ API in ewk_favicon_database and use C API
instead of avoid breaking API layering.

* PlatformEfl.cmake:
* UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp: Added.
(WKIconDatabaseTryGetCairoSurfaceForURL): Add C API for getting the
favicon for a given page URL as a cairo_surface_t*.
* UIProcess/API/C/cairo/WKIconDatabaseCairo.h: Added.
* UIProcess/API/efl/ewk_favicon_database.cpp:
(EwkFaviconDatabase::didChangeIconForPageURL):
(EwkFaviconDatabase::getIconSurfaceSynchronously):
(EwkFaviconDatabase::iconDataReadyForPageURL):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (140951 => 140952)


--- trunk/Source/WebKit2/ChangeLog	2013-01-28 08:53:48 UTC (rev 140951)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-28 09:02:32 UTC (rev 140952)
@@ -1,3 +1,23 @@
+2013-01-28  Christophe Dumez  <[email protected]>
+
+        [EFL][WK2] Rely more on C API in ewk_favicon_database
+        https://bugs.webkit.org/show_bug.cgi?id=108035
+
+        Reviewed by Benjamin Poulain.
+
+        Rely less on internal C++ API in ewk_favicon_database and use C API
+        instead of avoid breaking API layering.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp: Added.
+        (WKIconDatabaseTryGetCairoSurfaceForURL): Add C API for getting the
+        favicon for a given page URL as a cairo_surface_t*.
+        * UIProcess/API/C/cairo/WKIconDatabaseCairo.h: Added.
+        * UIProcess/API/efl/ewk_favicon_database.cpp:
+        (EwkFaviconDatabase::didChangeIconForPageURL):
+        (EwkFaviconDatabase::getIconSurfaceSynchronously):
+        (EwkFaviconDatabase::iconDataReadyForPageURL):
+
 2013-01-27  Alexey Proskuryakov  <[email protected]>
 
         Fix location of sandbox profiles in built products

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (140951 => 140952)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2013-01-28 08:53:48 UTC (rev 140951)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2013-01-28 09:02:32 UTC (rev 140952)
@@ -35,6 +35,8 @@
 
     Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp
 
+    UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp
+
     UIProcess/API/C/efl/WKView.cpp
 
     UIProcess/API/cpp/efl/WKEinaSharedString.cpp
@@ -163,6 +165,7 @@
     "${WEBKIT2_DIR}/Shared/Downloads/soup"
     "${WEBKIT2_DIR}/Shared/efl"
     "${WEBKIT2_DIR}/Shared/soup"
+    "${WEBKIT2_DIR}/UIProcess/API/C/cairo"
     "${WEBKIT2_DIR}/UIProcess/API/C/efl"
     "${WEBKIT2_DIR}/UIProcess/API/C/soup"
     "${WEBKIT2_DIR}/UIProcess/API/cpp/efl"

Added: trunk/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp (0 => 140952)


--- trunk/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.cpp	2013-01-28 09:02:32 UTC (rev 140952)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. 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 APPLE 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 "WKIconDatabaseCairo.h"
+
+#include "NativeImageCairo.h"
+#include "WKAPICast.h"
+#include "WebIconDatabase.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url)
+{
+    NativeImageCairo* nativeImage = toImpl(iconDatabase)->nativeImageForPageURL(toWTFString(url));
+
+    return nativeImage ? nativeImage->surface() : 0;
+}

Added: trunk/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h (0 => 140952)


--- trunk/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/cairo/WKIconDatabaseCairo.h	2013-01-28 09:02:32 UTC (rev 140952)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. 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 APPLE 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 <WebKit2/WKBase.h>
+
+typedef struct _cairo_surface cairo_surface_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT cairo_surface_t* WKIconDatabaseTryGetCairoSurfaceForURL(WKIconDatabaseRef iconDatabase, WKURLRef url);
+
+#ifdef __cplusplus
+}
+#endif

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp (140951 => 140952)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp	2013-01-28 08:53:48 UTC (rev 140951)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp	2013-01-28 09:02:32 UTC (rev 140952)
@@ -28,6 +28,7 @@
 
 #include "WKAPICast.h"
 #include "WKIconDatabase.h"
+#include "WKIconDatabaseCairo.h"
 #include "WKURL.h"
 #include "WebIconDatabase.h"
 #include "ewk_favicon_database_private.h"
@@ -134,7 +135,7 @@
     if (ewkIconDatabase->m_changeListeners.isEmpty())
         return;
 
-    CString pageURL = toImpl(pageURLRef)->string().utf8();
+    CString pageURL = toWTFString(pageURLRef).utf8();
 
     ChangeListenerMap::const_iterator it = ewkIconDatabase->m_changeListeners.begin();
     ChangeListenerMap::const_iterator end = ewkIconDatabase->m_changeListeners.end();
@@ -146,14 +147,12 @@
 {
     WKIconDatabaseRetainIconForURL(m_iconDatabase.get(), pageURL);
 
-    WebCore::NativeImagePtr icon = toImpl(m_iconDatabase.get())->nativeImageForPageURL(toWTFString(pageURL));
-    if (!icon) {
+    RefPtr<cairo_surface_t> surface = WKIconDatabaseTryGetCairoSurfaceForURL(m_iconDatabase.get(), pageURL);
+    if (!surface) {
         WKIconDatabaseReleaseIconForURL(m_iconDatabase.get(), pageURL);
         return 0;
     }
 
-    RefPtr<cairo_surface_t> surface = icon->surface();
-
     return surface.release();
 }
 
@@ -161,7 +160,7 @@
 {
     EwkFaviconDatabase* ewkIconDatabase = const_cast<EwkFaviconDatabase*>(static_cast<const EwkFaviconDatabase*>(clientInfo));
 
-    String urlString = toImpl(pageURL)->string();
+    String urlString = toWTFString(pageURL);
     if (!ewkIconDatabase->m_iconRequests.contains(urlString))
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to