[iOS] Update optimized fullscreen media controls
https://bugs.webkit.org/show_bug.cgi?id=138493

Reviewed by Brent Fulgham.

Source/WebCore:

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::fullscreenMode): New.
(WebCore::MediaControlsHost::mediaUIImageData): New.
* Modules/mediacontrols/MediaControlsHost.h:
* Modules/mediacontrols/MediaControlsHost.idl:

* Modules/mediacontrols/mediaControlsiOS.css:
Renamed -webkit-media-controls-wireless-playback-status to -webkit-media-controls-inline-playback-placeholder
    because it is now used for other inline playback status display. Add z-index:0 so the placeholder
    renders above captions. Remove the background-image, it is now set from script.
(audio::-webkit-media-controls-inline-playback-placeholder):
(audio::-webkit-media-controls-inline-playback-placeholder.hidden):
(video::-webkit-media-controls-optimized-fullscreen-button):
(audio::-webkit-media-controls-wireless-playback-status): Deleted.
(audio::-webkit-media-controls-wireless-playback-status.hidden): Deleted.
(video::-webkit-media-controls-optimized-fullscreen-button:active): Deleted.

* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS): Set doingSetup to true around setup so we don't draw the inline controls
    briefly when an element is created as a result of a user gesture.
(ControllerIOS.prototype.shouldHaveStartPlaybackButton): Don't allow inline controls during
    initial setup to prevent inline controls from begin drawn briefly when a media element
    is created and inserted by a script called from a user gesture.
(ControllerIOS.prototype.updateWirelessPlaybackStatus): wirelessPlaybackStatus -> inlinePlaybackPlaceholder.
(ControllerIOS.prototype.createControls): Ditto. Add style rules for optimized fullscreen button.
(ControllerIOS.prototype.configureInlineControls): Add the inlinePlaybackPlaceholder as a peer of
    the inline controls compositing child instead of as a child so it renders correctly.
(ControllerIOS.prototype.addControls):
(ControllerIOS.prototype.updateControls): wirelessPlaybackStatus -> inlinePlaybackPlaceholder.
(ControllerIOS.prototype.handleWrapperTouchStart):
(ControllerIOS.prototype.get pageScaleFactor): Cleanup.
(ControllerIOS.prototype.set pageScaleFactor): Ditto.
(ControllerIOS.prototype.handleFullscreenChange): Show the placeholder.

* WebCore.exp.in: Export _wkGetMediaUIImageData.

* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::fullscreenMode): Expose fullscreen mode.

* platform/ios/WebCoreSystemInterfaceIOS.h:
* platform/ios/WebCoreSystemInterfaceIOS.mm:

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Initialize GetMediaUIImageData.

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Initialize GetMediaUIImageData.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@175750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
bmalloc uses 8X more virtual memory than necessary
https://bugs.webkit.org/show_bug.cgi?id=138495

Reviewed by Mark Lam.

iOS has a per-process virtual memory cap around 1GB, so there's some
value to not going totally ham with virtual memory.

We currently use about 8X the necessary amount:
    - 2X to align our VM allocation
    - 4X to reserve small / medium / (2) large chunk VM ranges per superchunk

We can cut that down:
    - Return the unaligned portion of our VM allocation (-2X)
    - Use all the chunks in a superchunk, instead of allocating one
      chunk per superchunk (-4X)

* bmalloc/Algorithm.h:
(bmalloc::roundUpToMultipleOf): Added a non-constant version of this
function so we can call it with getpagesize() at runtime.

* bmalloc/Chunk.h:
* bmalloc/LargeChunk.h:
(bmalloc::LargeChunk::create): Deleted. Instead of each chunk allocating
its own VM, VMHeap allocates the superchunk and all the chunks in it at a time.

* bmalloc/VMAllocate.h:
(bmalloc::vmValidate):
(bmalloc::vmAllocate): ASSERT that mmap succeeds to make crashes clearer
if it does not succeed. Allocate precisely, and give back the extra.

* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::allocateSuperChunk):
(bmalloc::VMHeap::allocateSmallChunk): Deleted.
(bmalloc::VMHeap::allocateMediumChunk): Deleted.
(bmalloc::VMHeap::allocateLargeChunk): Deleted. Use all the chunks
in a superchunk, instead of just one.

* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateSmallPage):
(bmalloc::VMHeap::allocateMediumPage):
(bmalloc::VMHeap::allocateLargeRange):
* bmalloc/XLargeChunk.h:
(bmalloc::XLargeChunk::create): Updated to match changes above.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@175751 268f45cc-cd09-0410-ab3c-d52691b4dbfc