| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index b22e36738a6d56b8fc5494ae126db85ef990a710..ef2d6d4ceecb1ff71862f6df0df35d5cd76f6f5c 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -211,10 +211,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
|
| @@ -317,16 +317,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)
|
| @@ -455,8 +469,38 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
| WebViewImpl::~WebViewImpl()
|
| {
|
| ASSERT(!m_page);
|
| +#if ENABLE(OILPAN)
|
| + // At most one Persistent main frame reference should be set.
|
| + ASSERT(!(m_localMainFrame && m_remoteMainFrame));
|
| +#endif
|
| }
|
|
|
| +#if ENABLE(OILPAN)
|
| +void WebViewImpl::clearMainFrame(WebLocalFrameImpl* frame)
|
| +{
|
| + ASSERT(frame && frame->frame() && frame->frame()->isMainFrame());
|
| + // At most one Persistent main frame reference should be set.
|
| + ASSERT(!(m_localMainFrame && m_remoteMainFrame));
|
| +
|
| + // Assume that non-current main frames may attempt to clear
|
| + // themselves, so check for equality.
|
| + if (m_localMainFrame.get() == frame)
|
| + m_localMainFrame.clear();
|
| +}
|
| +
|
| +void WebViewImpl::clearMainFrame(WebRemoteFrameImpl* frame)
|
| +{
|
| + ASSERT(frame && frame->frame() && frame->frame()->isMainFrame());
|
| + // At most one Persistent main frame reference should be set.
|
| + ASSERT(!(m_localMainFrame && m_remoteMainFrame));
|
| +
|
| + // Assume that non-current main frames may attempt to clear
|
| + // themselves, so check for equality.
|
| + if (m_remoteMainFrame.get() == frame)
|
| + m_remoteMainFrame.clear();
|
| +}
|
| +#endif
|
| +
|
| WebLocalFrameImpl* WebViewImpl::mainFrameImpl()
|
| {
|
| return m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() ? WebLocalFrameImpl::fromFrame(m_page->deprecatedLocalMainFrame()) : 0;
|
| @@ -957,7 +1001,7 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
|
| return true;
|
| }
|
|
|
| - RefPtr<Frame> focusedFrame = focusedCoreFrame();
|
| + RefPtrWillBeRawPtr<Frame> focusedFrame = focusedCoreFrame();
|
| if (focusedFrame && focusedFrame->isRemoteFrameTemporary()) {
|
| WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(toLocalFrameTemporary(focusedFrame.get()));
|
| webFrame->client()->forwardInputEvent(&event);
|
| @@ -967,7 +1011,7 @@ bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
|
| if (!focusedFrame || !focusedFrame->isLocalFrame())
|
| return false;
|
|
|
| - RefPtr<LocalFrame> frame = toLocalFrame(focusedFrame.get());
|
| + LocalFrame* frame = toLocalFrame(focusedFrame.get());
|
|
|
| PlatformKeyboardEventBuilder evt(event);
|
|
|
| @@ -2029,7 +2073,7 @@ void WebViewImpl::setFocus(bool enable)
|
| m_page->focusController().setFocused(enable);
|
| if (enable) {
|
| m_page->focusController().setActive(true);
|
| - RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame();
|
| + RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focusedFrame();
|
| if (focusedFrame && focusedFrame->isLocalFrame()) {
|
| LocalFrame* localFrame = toLocalFrame(focusedFrame.get());
|
| Element* element = localFrame->document()->focusedElement();
|
| @@ -2062,7 +2106,7 @@ void WebViewImpl::setFocus(bool enable)
|
| if (!frame)
|
| return;
|
|
|
| - RefPtr<Frame> focusedFrame = m_page->focusController().focusedFrame();
|
| + RefPtrWillBeRawPtr<Frame> focusedFrame = m_page->focusController().focusedFrame();
|
| if (focusedFrame && focusedFrame->isLocalFrame()) {
|
| // Finish an ongoing composition to delete the composition node.
|
| if (toLocalFrame(focusedFrame.get())->inputMethodController().hasComposition()) {
|
| @@ -2676,7 +2720,7 @@ void WebViewImpl::setInitialFocus(bool reverse)
|
|
|
| void WebViewImpl::clearFocusedElement()
|
| {
|
| - RefPtr<Frame> frame = focusedCoreFrame();
|
| + RefPtrWillBeRawPtr<Frame> frame = focusedCoreFrame();
|
| if (!frame || !frame->isLocalFrame())
|
| return;
|
|
|
|
|