bmalloc: tryFastMalloc shouldn't crash
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Mar 2015 18:43:08 +0000 (18:43 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Mar 2015 18:43:08 +0000 (18:43 +0000)
commit0df3b24f9dccae1e9c2de5d550a4ebe15301e426
treef7af5aae0c34633b8bac319c4744acaa2176f543
parent2c2cb76118fd096e434932c14222e27e04ab5c56
bmalloc: tryFastMalloc shouldn't crash
https://bugs.webkit.org/show_bug.cgi?id=142443

Reviewed by Anders Carlsson.

Part 1: Stop using tryFastRealloc.

* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::resize): Deleted.
* Shared/ShareableBitmap.h: Removed the resize function because it has
no clients.

* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::updateBackingStore): Changed to allocate a new
backing store instead of resizing the old one. This has three advantages:

(1) Might be more memory-efficient, since you don't have to keep the old
one around while allocating the new one.

(2) Avoids the overhead of realloc() copying the contents of the old
backing store even though we only want uninitialized memory.

(3) Makes resize failure consistent with initial allocation failure.
Previously, while initial allocation failure would set the backing store
to null, resize failure would keep the old wrong backing store and then
tell it not to paint. Now, resize failure also sets the backing store to
null.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181272 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/ShareableBitmap.cpp
Source/WebKit2/Shared/ShareableBitmap.h
Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp