Make creating send rights from shared memory more robust
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Apr 2015 17:32:26 +0000 (17:32 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Apr 2015 17:32:26 +0000 (17:32 +0000)
commitc5f4b21a076f6c69557e64acb9f76b45ac791ac2
tree5fcfff022de740a7e2ebc2169c49c5e1a2e1e7c1
parentf2d72685bb2f9280decf6d6c8c9178a7b43b1cd7
Make creating send rights from shared memory more robust
https://bugs.webkit.org/show_bug.cgi?id=143730
rdar://problem/16595870

Reviewed by Darin Adler.

Source/WebCore:

Add a bool conversion operator to MachSendRight and tidy up the default constructor.

* platform/cocoa/MachSendRight.h:
(WebCore::MachSendRight::operator bool):
(WebCore::MachSendRight::MachSendRight): Deleted.

Source/WebKit2:

This cleans up creation of handles and send rights and also fixes a bug where it would be impossible
to send more than 128 MB of shared memory in a single object.

* Platform/SharedMemory.h:
* Platform/mac/SharedMemoryMac.cpp:
(WebKit::makeMemoryEntry):
New helper function that creates a memory entry send right. This uses MAP_MEM_VM_SHARE which ensures
that memory objects larger than 128 MB will be handled correctly.

(WebKit::SharedMemory::create):
Call makeMemoryEntry.

(WebKit::SharedMemory::createHandle):
Call createSendRight.

(WebKit::SharedMemory::createSendRight):
Call makeMemoryEntry and add the necessary assertions.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/cocoa/MachSendRight.h
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/SharedMemory.h
Source/WebKit2/Platform/mac/SharedMemoryMac.cpp