Title: [88967] trunk/Source/WebKit2
Revision
88967
Author
[email protected]
Date
2011-06-15 12:50:30 -0700 (Wed, 15 Jun 2011)

Log Message

2011-06-15  Anders Carlsson  <[email protected]>

        Reviewed by Darin Adler.

        Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
        https://bugs.webkit.org/show_bug.cgi?id=62742

        * Shared/ShareableBitmap.h:
        Move createImage out of the #if PLATFORM(QT) section.

        * Shared/WebCoreArgumentCoders.cpp:
        (CoreIPC::decodeImage):
        Call ShareableBitmap::createImage.

        * Shared/WebCoreArgumentCoders.h:
        remove createImage function declaration.

        * Shared/cairo/ShareableBitmapCairo.cpp:
        (WebKit::ShareableBitmap::createImage):
        Add implementation.

        * Shared/cg/ShareableBitmapCG.cpp:
        (WebKit::ShareableBitmap::createGraphicsContext):
        (WebKit::ShareableBitmap::createImage):
        Move createImage implementation from WebCoreArgumentCodersCG.cpp here.

        * WebKit2.xcodeproj/project.pbxproj:
        * win/WebKit2.vcproj:
        Update projects.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (88966 => 88967)


--- trunk/Source/WebKit2/ChangeLog	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-15 19:50:30 UTC (rev 88967)
@@ -1,5 +1,35 @@
 2011-06-15  Anders Carlsson  <[email protected]>
 
+        Reviewed by Darin Adler.
+
+        Add ShareableBitmap::createImage and get rid of WebCoreArgumentCodersCG.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=62742
+
+        * Shared/ShareableBitmap.h:
+        Move createImage out of the #if PLATFORM(QT) section.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (CoreIPC::decodeImage):
+        Call ShareableBitmap::createImage.
+
+        * Shared/WebCoreArgumentCoders.h:
+        remove createImage function declaration.
+
+        * Shared/cairo/ShareableBitmapCairo.cpp:
+        (WebKit::ShareableBitmap::createImage):
+        Add implementation.
+
+        * Shared/cg/ShareableBitmapCG.cpp:
+        (WebKit::ShareableBitmap::createGraphicsContext):
+        (WebKit::ShareableBitmap::createImage):
+        Move createImage implementation from WebCoreArgumentCodersCG.cpp here.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+        Update projects.
+
+2011-06-15  Anders Carlsson  <[email protected]>
+
         Reviewed by Alexey Proskuryakov.
 
         Move some argument coders to WebCoreArgumentCoders.cpp

Modified: trunk/Source/WebKit2/Shared/ShareableBitmap.h (88966 => 88967)


--- trunk/Source/WebKit2/Shared/ShareableBitmap.h	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/Shared/ShareableBitmap.h	2011-06-15 19:50:30 UTC (rev 88967)
@@ -27,7 +27,6 @@
 #define ShareableBitmap_h
 
 #include "SharedMemory.h"
-#include <WebCore/Image.h>
 #include <WebCore/IntRect.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -47,6 +46,7 @@
 #endif
 
 namespace WebCore {
+    class Image;
     class GraphicsContext;
 }
 
@@ -107,6 +107,10 @@
 
     bool isBackedBySharedMemory() const { return m_sharedMemory; }
 
+    // This creates a bitmap image that directly references the shared bitmap data.
+    // This is only safe to use when we know that the contents of the shareable bitmap won't change.
+    PassRefPtr<WebCore::Image> createImage();
+
 #if USE(CG)
     // This creates a copied CGImageRef (most likely a copy-on-write) of the shareable bitmap.
     RetainPtr<CGImageRef> makeCGImageCopy();
@@ -122,7 +126,6 @@
     // This creates a QImage that directly references the shared bitmap data.
     // This is only safe to use when we know that the contents of the shareable bitmap won't change.
     QImage createQImage();
-    PassRefPtr<WebCore::Image> createImage();
 #endif
 
 private:

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (88966 => 88967)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2011-06-15 19:50:30 UTC (rev 88967)
@@ -181,7 +181,7 @@
     RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle);
     if (!bitmap)
         return false;
-    image = createImage(bitmap.get());
+    image = bitmap->createImage();
     if (!image)
         return false;
     return true;

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (88966 => 88967)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2011-06-15 19:50:30 UTC (rev 88967)
@@ -141,7 +141,6 @@
 
 void encodeImage(ArgumentEncoder*, WebCore::Image*);
 bool decodeImage(ArgumentDecoder*, RefPtr<WebCore::Image>&);
-RefPtr<WebCore::Image> createImage(WebKit::ShareableBitmap*);
 
 template<> struct ArgumentCoder<WebCore::Cursor> {
     static void encode(ArgumentEncoder* encoder, const WebCore::Cursor& cursor)

Modified: trunk/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp (88966 => 88967)


--- trunk/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/Shared/cairo/ShareableBitmapCairo.cpp	2011-06-15 19:50:30 UTC (rev 88967)
@@ -28,9 +28,9 @@
 #include "config.h"
 #include "ShareableBitmap.h"
 
+#include <WebCore/BitmapImage.h>
 #include <WebCore/CairoUtilities.h>
 #include <WebCore/GraphicsContext.h>
-#include <WebCore/NotImplemented.h>
 #include <WebCore/PlatformContextCairo.h>
 
 using namespace WebCore;
@@ -72,4 +72,14 @@
     static_cast<ShareableBitmap*>(typelessBitmap)->deref(); // Balanced by ref in createCairoSurface.
 }
 
+PassRefPtr<Image> ShareableBitmap::createImage()
+{
+    RefPtr<cairo_surface_t> surface = createCairoSurface();
+    if (!surface)
+        return 0;
+
+    // BitmapImage::create adopts the cairo_surface_t that's passed in, which is why we need to leakRef here.
+    return BitmapImage::create(surface.release().leakRef());
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp (88966 => 88967)


--- trunk/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp	2011-06-15 19:50:30 UTC (rev 88967)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ShareableBitmap.h"
 
+#include <WebCore/BitmapImage.h>
 #include <WebCore/GraphicsContext.h>
 #include <wtf/RetainPtr.h>
 #include "CGUtilities.h"
@@ -49,7 +50,6 @@
 {
     RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
 
-
     ref(); // Balanced by deref in releaseBitmapContextData.
     RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreateWithData(data(),
         m_size.width(), m_size.height(), 8, m_size.width() * 4, colorSpace.get(),
@@ -106,4 +106,14 @@
     bitmap->deref(); // Balanced by ref in createCGImage.
 }
 
+PassRefPtr<Image> ShareableBitmap::createImage()
+{
+    RetainPtr<CGImageRef> platformImage = makeCGImage();
+    if (!platformImage)
+        return 0;
+
+    // BitmapImage::create adopts the CGImageRef that's passed in, which is why we need to leakRef here.
+    return BitmapImage::create(platformImage.leakRef());
+}
+
 } // namespace WebKit

Deleted: trunk/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp (88966 => 88967)


--- trunk/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/Shared/cg/WebCoreArgumentCodersCG.cpp	2011-06-15 19:50:30 UTC (rev 88967)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 Apple 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 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 "WebCoreArgumentCoders.h"
-
-#include "ShareableBitmap.h"
-#include <WebCore/BitmapImage.h>
-
-using namespace WebCore;
-using namespace WebKit;
-
-namespace CoreIPC {
-
-RefPtr<Image> createImage(ShareableBitmap* bitmap)
-{
-    RetainPtr<CGImageRef> platformImage = bitmap->makeCGImage();
-    if (!platformImage)
-        return 0;
-    // BitmapImage::create adopts the CGImageRef that's passed in, which is why we need to leakRef here.
-    return BitmapImage::create(platformImage.leakRef());
-}
-    
-}

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (88966 => 88967)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-06-15 19:50:30 UTC (rev 88967)
@@ -412,7 +412,6 @@
 		9391F2CA121B679A00EBF7E8 /* WebFrameNetworkingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */; };
 		9391F2CB121B67AD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */; };
 		939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */; };
-		939AE7681316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939AE7671316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp */; };
 		93C01DAC139AC91700ED51D7 /* CoreIPCClientRunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C01DAA139AC91700ED51D7 /* CoreIPCClientRunLoop.h */; };
 		93C01DAD139AC91700ED51D7 /* CoreIPCClientRunLoop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93C01DAB139AC91700ED51D7 /* CoreIPCClientRunLoop.mm */; };
 		93FC67BD12D3CCF200A60610 /* DecoderAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */; };
@@ -1351,7 +1350,6 @@
 		9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameNetworkingContext.h; sourceTree = "<group>"; };
 		9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameNetworkingContext.mm; sourceTree = "<group>"; };
 		939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCoders.cpp; sourceTree = "<group>"; };
-		939AE7671316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreArgumentCodersCG.cpp; sourceTree = "<group>"; };
 		93C01DAA139AC91700ED51D7 /* CoreIPCClientRunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreIPCClientRunLoop.h; sourceTree = "<group>"; };
 		93C01DAB139AC91700ED51D7 /* CoreIPCClientRunLoop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreIPCClientRunLoop.mm; sourceTree = "<group>"; };
 		93FC679D12D3CC7400A60610 /* DecoderAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DecoderAdapter.cpp; sourceTree = "<group>"; };
@@ -3253,7 +3251,6 @@
 			isa = PBXGroup;
 			children = (
 				C01A260012662F2100C9ED55 /* ShareableBitmapCG.cpp */,
-				939AE7671316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp */,
 			);
 			path = cg;
 			sourceTree = "<group>";
@@ -4440,7 +4437,6 @@
 				51A9E1281315ED35009E7031 /* WebKeyValueStorageManagerMessageReceiver.cpp in Sources */,
 				51A9E12A1315ED35009E7031 /* WebKeyValueStorageManagerProxyMessageReceiver.cpp in Sources */,
 				939AE7661316E99C00AE06A6 /* WebCoreArgumentCoders.cpp in Sources */,
-				939AE7681316E9AD00AE06A6 /* WebCoreArgumentCodersCG.cpp in Sources */,
 				330934471315B9220097A7BC /* WebCookieManagerMessageReceiver.cpp in Sources */,
 				330934491315B9220097A7BC /* WebCookieManagerProxyMessageReceiver.cpp in Sources */,
 				3309344F1315B94D0097A7BC /* WebCookieManager.cpp in Sources */,

Modified: trunk/Source/WebKit2/win/WebKit2.vcproj (88966 => 88967)


--- trunk/Source/WebKit2/win/WebKit2.vcproj	2011-06-15 19:42:29 UTC (rev 88966)
+++ trunk/Source/WebKit2/win/WebKit2.vcproj	2011-06-15 19:50:30 UTC (rev 88967)
@@ -1305,26 +1305,6 @@
 						/>
 					</FileConfiguration>
 				</File>
-				<File
-					RelativePath="..\Shared\cg\WebCoreArgumentCodersCG.cpp"
-					>
-					<FileConfiguration
-						Name="Debug_Cairo_CFLite|Win32"
-						ExcludedFromBuild="true"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release_Cairo_CFLite|Win32"
-						ExcludedFromBuild="true"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-						/>
-					</FileConfiguration>
-				</File>
 				<Filter
 					Name="win"
 					>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to