Skip to content
Permalink
Browse files
-[_WKThumbnailView _requestSnapshotIfNeeded] assumes that taking a sn…
…apshot will always succeed

<https://webkit.org/b/132489> / <rdar://problem/16704660>

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView _requestSnapshotIfNeeded]): Don't attempt to create a CGImageRef if we failed
to create a ShareableBitmap. This handles both the callback receiving a null Handle and a failure
within ShareableBitmap::create.

Canonical link: https://commits.webkit.org/150523@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
bdash committed May 2, 2014
1 parent 20abdd8 commit 0c11af1133d80c28e568ead5cb57a19acb10abbc
Showing 2 changed files with 13 additions and 1 deletion.
@@ -1,3 +1,15 @@
2014-05-02 Mark Rowe <mrowe@apple.com>

-[_WKThumbnailView _requestSnapshotIfNeeded] assumes that taking a snapshot will always succeed
<https://webkit.org/b/132489> / <rdar://problem/16704660>

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView _requestSnapshotIfNeeded]): Don't attempt to create a CGImageRef if we failed
to create a ShareableBitmap. This handles both the callback receiving a null Handle and a failure
within ShareableBitmap::create.

2014-05-02 Anders Carlsson <andersca@apple.com>

Clean up FormDataElement
@@ -131,7 +131,7 @@ - (void)_requestSnapshotIfNeeded
_lastSnapshotScale = _scale;
_webPageProxy->takeSnapshot(snapshotRect, bitmapSize, options, [thumbnailView](bool, const ShareableBitmap::Handle& imageHandle) {
RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(imageHandle, SharedMemory::ReadOnly);
RetainPtr<CGImageRef> cgImage = bitmap->makeCGImage();
RetainPtr<CGImageRef> cgImage = bitmap ? bitmap->makeCGImage() : nullptr;
[thumbnailView _didTakeSnapshot:cgImage.get()];
});
}

0 comments on commit 0c11af1

Please sign in to comment.