Commit 5923c0ee authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Oilpan: move page's ValidationMessageClient to the heap.

Avoids keeping a bare pointer to the current anchor from the client
implementation object.

R=ager@chromium.org,zerny@chromium.org,haraken@chromium.org,tkent@chromium.org
BUG=340522

Review URL: https://codereview.chromium.org/334153003

git-svn-id: svn://svn.chromium.org/blink/trunk@176206 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7d60ac92
......@@ -312,7 +312,7 @@ void Page::unmarkAllTextMatches()
} while (frame);
}
void Page::setValidationMessageClient(PassOwnPtr<ValidationMessageClient> client)
void Page::setValidationMessageClient(PassOwnPtrWillBeRawPtr<ValidationMessageClient> client)
{
m_validationMessageClient = client;
}
......@@ -594,6 +594,7 @@ void Page::trace(Visitor* visitor)
visitor->trace(m_dragCaretController);
visitor->trace(m_dragController);
visitor->trace(m_pointerLockController);
visitor->trace(m_validationMessageClient);
visitor->trace(m_multisamplingChangedObservers);
visitor->trace(m_frameHost);
WillBeHeapSupplementable<Page>::trace(visitor);
......
......@@ -156,7 +156,7 @@ public:
InspectorController& inspectorController() const { return *m_inspectorController; }
PointerLockController& pointerLockController() const { return *m_pointerLockController; }
ValidationMessageClient& validationMessageClient() const { return *m_validationMessageClient; }
void setValidationMessageClient(PassOwnPtr<ValidationMessageClient>);
void setValidationMessageClient(PassOwnPtrWillBeRawPtr<ValidationMessageClient>);
ScrollingCoordinator* scrollingCoordinator();
......@@ -267,7 +267,7 @@ private:
EditorClient* const m_editorClient;
SpellCheckerClient* const m_spellCheckerClient;
StorageClient* m_storageClient;
OwnPtr<ValidationMessageClient> m_validationMessageClient;
OwnPtrWillBeMember<ValidationMessageClient> m_validationMessageClient;
UseCounter m_useCounter;
......
......@@ -26,6 +26,7 @@
#ifndef ValidationMessageClient_h
#define ValidationMessageClient_h
#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
namespace WebCore {
......@@ -33,7 +34,7 @@ namespace WebCore {
class Document;
class Element;
class ValidationMessageClient {
class ValidationMessageClient : public WillBeGarbageCollectedMixin {
public:
virtual ~ValidationMessageClient() { }
......@@ -53,6 +54,8 @@ public:
virtual void documentDetached(const Document&) = 0;
virtual void willBeDestroyed() = 0;
virtual void trace(Visitor*) { }
};
}
......
......@@ -43,16 +43,16 @@ namespace blink {
ValidationMessageClientImpl::ValidationMessageClientImpl(WebViewImpl& webView)
: m_webView(webView)
, m_currentAnchor(0)
, m_currentAnchor(nullptr)
, m_lastPageScaleFactor(1)
, m_finishTime(0)
, m_timer(this, &ValidationMessageClientImpl::checkAnchorStatus)
{
}
PassOwnPtr<ValidationMessageClientImpl> ValidationMessageClientImpl::create(WebViewImpl& webView)
PassOwnPtrWillBeRawPtr<ValidationMessageClientImpl> ValidationMessageClientImpl::create(WebViewImpl& webView)
{
return adoptPtr(new ValidationMessageClientImpl(webView));
return adoptPtrWillBeNoop(new ValidationMessageClientImpl(webView));
}
ValidationMessageClientImpl::~ValidationMessageClientImpl()
......@@ -98,7 +98,7 @@ void ValidationMessageClientImpl::hideValidationMessage(const Element& anchor)
if (!m_currentAnchor || !isValidationMessageVisible(anchor))
return;
m_timer.stop();
m_currentAnchor = 0;
m_currentAnchor = nullptr;
m_message = String();
m_finishTime = 0;
m_webView.client()->hideValidationMessage();
......@@ -146,4 +146,10 @@ void ValidationMessageClientImpl::willBeDestroyed()
hideValidationMessage(*m_currentAnchor);
}
void ValidationMessageClientImpl::trace(Visitor* visitor)
{
visitor->trace(m_currentAnchor);
ValidationMessageClient::trace(visitor);
}
}
......@@ -29,6 +29,7 @@
#include "core/page/ValidationMessageClient.h"
#include "platform/Timer.h"
#include "platform/geometry/IntRect.h"
#include "platform/heap/Handle.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
......@@ -39,11 +40,14 @@ namespace blink {
class WebViewImpl;
class ValidationMessageClientImpl FINAL : public WebCore::ValidationMessageClient {
class ValidationMessageClientImpl FINAL : public NoBaseWillBeGarbageCollectedFinalized<ValidationMessageClientImpl>, public WebCore::ValidationMessageClient {
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ValidationMessageClientImpl);
public:
static PassOwnPtr<ValidationMessageClientImpl> create(WebViewImpl&);
static PassOwnPtrWillBeRawPtr<ValidationMessageClientImpl> create(WebViewImpl&);
virtual ~ValidationMessageClientImpl();
virtual void trace(WebCore::Visitor*) OVERRIDE;
private:
ValidationMessageClientImpl(WebViewImpl&);
void checkAnchorStatus(WebCore::Timer<ValidationMessageClientImpl>*);
......@@ -56,7 +60,7 @@ private:
virtual void willBeDestroyed() OVERRIDE;
WebViewImpl& m_webView;
const WebCore::Element* m_currentAnchor;
RawPtrWillBeMember<const WebCore::Element> m_currentAnchor;
String m_message;
WebCore::IntRect m_lastAnchorRectInScreen;
float m_lastPageScaleFactor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment