FrameLoader::checkCompleted can hit the "ref'ing while destroyed" assertion
https://bugs.webkit.org/show_bug.cgi?id=132163
rdar://problem/16720640

Reviewed by Brady Eidson.

Couldn't find a way to test this yet. Would be nice to have a test.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkCompleted): Move protector until after we check
if the frame is already complete. That can happen in practice when this is
called from within the frame's destructor. All the code that runs before the
protector simply checks state and does not require protection.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix typo in comment from last check-in

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS WebKit2] RemoteLayerTreeDrawingArea should force CA to garbage collect surfaces.
<https://webkit.org/b/132160>
<rdar://problem/16110687>

Do an empty CATransaction at the end of RemoteLayerTreeDrawingArea::flushLayers()
to get CA to garbage collect its IOSurfaces. This helps clean up unused surfaces
that we'd otherwise end up hanging on to for a long time.

Reviewed by Tim Horton.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::didUpdate):

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