Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index a22d0eb4051eef44d6c7a23bc0bd0afc94f0597e..33f6e57fb1a50f8dc34871c9f73e4d98b12f7c43 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -49,6 +49,7 @@ |
#include "core/events/WheelEvent.h" |
#include "core/frame/EventHandlerRegistry.h" |
#include "core/frame/FrameHost.h" |
+#include "core/frame/FrameProtector.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/PinchViewport.h" |
@@ -208,10 +209,10 @@ const double WebView::maxTextSizeMultiplier = 3.0; |
// Used to defer all page activity in cases where the embedder wishes to run |
// a nested event loop. Using a stack enables nesting of message loop invocations. |
-static Vector<ScopedPageLoadDeferrer*>& pageLoadDeferrerStack() |
+static WillBeHeapVector<RawPtrWillBeMember<ScopedPageLoadDeferrer> >& pageLoadDeferrerStack() |
{ |
- DEFINE_STATIC_LOCAL(Vector<ScopedPageLoadDeferrer*>, deferrerStack, ()); |
- return deferrerStack; |
+ DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapVector<RawPtrWillBeMember<ScopedPageLoadDeferrer> > >, deferrerStack, (adoptPtrWillBeNoop(new WillBeHeapVector<RawPtrWillBeMember<ScopedPageLoadDeferrer> > ()))); |
+ return *deferrerStack; |
} |
// Ensure that the WebDragOperation enum values stay in sync with the original |
@@ -314,16 +315,30 @@ void WebView::didExitModalLoop() |
{ |
ASSERT(pageLoadDeferrerStack().size()); |
- delete pageLoadDeferrerStack().last(); |
+ ScopedPageLoadDeferrer* deferrer = pageLoadDeferrerStack().last(); |
+#if ENABLE(OILPAN) |
+ deferrer->dispose(); |
+#else |
+ delete deferrer; |
+#endif |
pageLoadDeferrerStack().removeLast(); |
} |
void WebViewImpl::setMainFrame(WebFrame* frame) |
{ |
- if (frame->isWebLocalFrame()) |
+ if (frame->isWebLocalFrame()) { |
+#if ENABLE(OILPAN) |
+ m_localMainFrame = toWebLocalFrameImpl(frame); |
+ m_remoteMainFrame.clear(); |
+#endif |
toWebLocalFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullAtom); |
- else |
+ } else { |
+#if ENABLE(OILPAN) |
+ m_localMainFrame.clear(); |
+ m_remoteMainFrame = toWebRemoteFrameImpl(frame); |
+#endif |
toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0, nullAtom); |
+ } |
} |
void WebViewImpl::setAutofillClient(WebAutofillClient* autofillClient) |
@@ -953,9 +968,10 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) |
return true; |
} |
- RefPtr<Frame> focusedFrame = focusedCoreFrame(); |
+ Frame* focusedFrame = focusedCoreFrame(); |
+ FrameProtector protect(focusedFrame); |
if (focusedFrame && focusedFrame->isRemoteFrameTemporary()) { |
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrameTemporary(focusedFrame.get())); |
+ WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrameTemporary(focusedFrame)); |
webFrame->client()->forwardInputEvent(&event); |
return true; |
} |
@@ -963,7 +979,7 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) |
if (!focusedFrame || !focusedFrame->isLocalFrame()) |
return false; |
- RefPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get()); |
+ LocalFrame* frame = toLocalFrame(focusedFrame); |
PlatformKeyboardEventBuilder evt(event); |
@@ -2012,9 +2028,10 @@ void WebViewImpl::setFocus(bool enable) |
m_page->focusController().setFocused(enable); |
if (enable) { |
m_page->focusController().setActive(true); |
- RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame(); |
+ Frame* focusedFrame = m_page->focusController().focusedFrame(); |
+ FrameProtector protect(focusedFrame); |
if (focusedFrame && focusedFrame->isLocalFrame()) { |
- LocalFrame* localFrame = toLocalFrame(focusedFrame.get()); |
+ LocalFrame* localFrame = toLocalFrame(focusedFrame); |
Element* element = localFrame->document()->focusedElement(); |
if (element && localFrame->selection().selection().isNone()) { |
// If the selection was cleared while the WebView was not |
@@ -2045,14 +2062,15 @@ void WebViewImpl::setFocus(bool enable) |
if (!frame) |
return; |
- RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame(); |
+ Frame* focusedFrame = m_page->focusController().focusedFrame(); |
+ FrameProtector protect(focusedFrame); |
if (focusedFrame && focusedFrame->isLocalFrame()) { |
// Finish an ongoing composition to delete the composition node. |
- if (toLocalFrame(focusedFrame.get())->inputMethodController().hasComposition()) { |
+ if (toLocalFrame(focusedFrame)->inputMethodController().hasComposition()) { |
if (m_autofillClient) |
m_autofillClient->setIgnoreTextChanges(true); |
- toLocalFrame(focusedFrame.get())->inputMethodController().confirmComposition(); |
+ toLocalFrame(focusedFrame)->inputMethodController().confirmComposition(); |
if (m_autofillClient) |
m_autofillClient->setIgnoreTextChanges(false); |
@@ -2654,11 +2672,12 @@ void WebViewImpl::setInitialFocus(bool reverse) |
void WebViewImpl::clearFocusedElement() |
{ |
- RefPtr<Frame> frame = focusedCoreFrame(); |
+ Frame* frame = focusedCoreFrame(); |
if (!frame || !frame->isLocalFrame()) |
return; |
- LocalFrame* localFrame = toLocalFrame(frame.get()); |
+ FrameProtector protect(frame); |
+ LocalFrame* localFrame = toLocalFrame(frame); |
RefPtrWillBeRawPtr<Document> document = localFrame->document(); |
if (!document) |
@@ -3105,7 +3124,8 @@ void WebViewImpl::updateMainFrameLayoutSize() |
if (m_fixedLayoutSizeLock || m_shouldAutoResize || !mainFrameImpl()) |
return; |
- RefPtr<FrameView> view = mainFrameImpl()->frameView(); |
+ FrameView* view = mainFrameImpl()->frameView(); |
+ FrameViewProtector protect(view); |
if (!view) |
return; |
@@ -3183,7 +3203,8 @@ void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
if (!frame) |
return; |
- RefPtr<FrameView> view = frame->view(); |
+ FrameView* view = frame->view(); |
+ FrameViewProtector protect(view); |
if (!view) |
return; |