Title: [124403] trunk/Source/WebKit/blackberry
Revision
124403
Author
[email protected]
Date
2012-08-01 20:55:40 -0700 (Wed, 01 Aug 2012)

Log Message

[BlackBerry] Favicon should be Base64 encoded for cross-process passing
https://bugs.webkit.org/show_bug.cgi?id=92857

Reviewed by George Staikos.

The current implementation just passes the internal of SkPixels data to the client,
which can't be passed accross the process boundary to chrome for processing.
This patch makes the favicon Base64 encoded so that can be passed to chrome in another process.

* Api/WebPageClient.h:
* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidReceiveIcon):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (124402 => 124403)


--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-08-02 03:08:10 UTC (rev 124402)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h	2012-08-02 03:55:40 UTC (rev 124403)
@@ -187,7 +187,7 @@
     virtual unsigned long long databaseQuota(const unsigned short* origin, unsigned originLength, const unsigned short* databaseName, unsigned databaseNameLength, unsigned long long totalUsage, unsigned long long originUsage, unsigned long long estimatedSize) = 0;
 
     virtual void setIconForUrl(const char* originalPageUrl, const char* finalPageUrl, const char* iconUrl) = 0;
-    virtual void setFavicon(int width, int height, unsigned char* iconData, const char* url) = 0;
+    virtual void setFavicon(const char* dataInBase64, const char* url) = 0;
     virtual void setLargeIcon(const char* iconUrl) = 0;
     virtual void setWebAppCapable() = 0;
     virtual void setSearchProviderDetails(const char* title, const char* documentUrl) = 0;

Modified: trunk/Source/WebKit/blackberry/ChangeLog (124402 => 124403)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-08-02 03:08:10 UTC (rev 124402)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-08-02 03:55:40 UTC (rev 124403)
@@ -1,3 +1,18 @@
+2012-08-01  Charles Wei  <[email protected]>
+
+        [BlackBerry] Favicon should be Base64 encoded for cross-process passing
+        https://bugs.webkit.org/show_bug.cgi?id=92857
+
+        Reviewed by George Staikos.
+
+        The current implementation just passes the internal of SkPixels data to the client,
+        which can't be passed accross the process boundary to chrome for processing.
+        This patch makes the favicon Base64 encoded so that can be passed to chrome in another process.
+
+        * Api/WebPageClient.h:
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDidReceiveIcon):
+
 2012-08-01  Jacky Jiang  <[email protected]>
 
         [BlackBerry] Allow client side to add and remove origin access whitelist entries

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (124402 => 124403)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2012-08-02 03:08:10 UTC (rev 124402)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2012-08-02 03:55:40 UTC (rev 124403)
@@ -58,6 +58,9 @@
 #include "ProtectionSpace.h"
 #include "ScopePointer.h"
 #include "SharedBuffer.h"
+#include "SkData.h"
+#include "SkImageEncoder.h"
+#include "SkStream.h"
 #include "TextEncoding.h"
 #include "TouchEventHandler.h"
 #if ENABLE(WEBDOM)
@@ -1184,13 +1187,22 @@
 {
     String url = ""
     NativeImageSkia* bitmap = iconDatabase().synchronousNativeIconForPageURL(url, IntSize(10, 10));
-    if (!bitmap)
+    if (!bitmap || bitmap->bitmap().empty())
         return;
 
-    bitmap->lockPixels();
+    SkAutoLockPixels locker(bitmap->bitmap());
+    SkDynamicMemoryWStream writer;
+    if (!SkImageEncoder::EncodeStream(&writer, bitmap->bitmap(), SkImageEncoder::kPNG_Type, 100)) {
+        BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelInfo, "Failed to convert the icon to PNG format.");
+        return;
+    }
+    SkData* data = ""
+    Vector<char> out;
+    base64Encode(static_cast<const char*>(data->data()), data->size(), out);
+    out.append('\0'); // Make it null-terminated.
     String iconUrl = iconDatabase().synchronousIconURLForPageURL(url);
-    m_webPagePrivate->m_client->setFavicon(img->width(), img->height(), (unsigned char*)bitmap->getPixels(), iconUrl.utf8().data());
-    bitmap->unlockPixels();
+    m_webPagePrivate->m_client->setFavicon(out.data(), iconUrl.utf8().data());
+    data->unref();
 }
 
 bool FrameLoaderClientBlackBerry::canCachePage() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to