Commit 93c712cc authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Make blink::PopupOpeningObserver a GarbageCollectedMixin

All of PopupOpeningObserver implementors are on GC heap, and having
raw pointers to them is dangerous.

This CL is a preparation to make blink::FileInputType a
PopupOpeningObserver.

Bug: 637639
Change-Id: Iee014462716cc3c3de91ddf365ab8644e2de5f2e
Reviewed-on: https://chromium-review.googlesource.com/1113084
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569983}
parent 99a2c2bc
...@@ -36,6 +36,8 @@ namespace blink { ...@@ -36,6 +36,8 @@ namespace blink {
class CORE_EXPORT SpinButtonElement final : public HTMLDivElement, class CORE_EXPORT SpinButtonElement final : public HTMLDivElement,
public PopupOpeningObserver { public PopupOpeningObserver {
USING_GARBAGE_COLLECTED_MIXIN(SpinButtonElement);
public: public:
enum UpDownState { enum UpDownState {
kIndeterminate, // Hovered, but the event is not handled. kIndeterminate, // Hovered, but the event is not handled.
......
...@@ -159,6 +159,11 @@ ChromeClientImpl* ChromeClientImpl::Create(WebViewImpl* web_view) { ...@@ -159,6 +159,11 @@ ChromeClientImpl* ChromeClientImpl::Create(WebViewImpl* web_view) {
return new ChromeClientImpl(web_view); return new ChromeClientImpl(web_view);
} }
void ChromeClientImpl::Trace(Visitor* visitor) {
visitor->Trace(popup_opening_observers_);
ChromeClient::Trace(visitor);
}
WebViewImpl* ChromeClientImpl::GetWebView() const { WebViewImpl* ChromeClientImpl::GetWebView() const {
return web_view_; return web_view_;
} }
...@@ -1097,8 +1102,9 @@ void ChromeClientImpl::UnregisterPopupOpeningObserver( ...@@ -1097,8 +1102,9 @@ void ChromeClientImpl::UnregisterPopupOpeningObserver(
} }
void ChromeClientImpl::NotifyPopupOpeningObservers() const { void ChromeClientImpl::NotifyPopupOpeningObservers() const {
const Vector<PopupOpeningObserver*> observers(popup_opening_observers_); const HeapVector<Member<PopupOpeningObserver>> observers(
for (auto* const observer : observers) popup_opening_observers_);
for (const auto& observer : observers)
observer->WillOpenPopup(); observer->WillOpenPopup();
} }
......
...@@ -52,6 +52,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient { ...@@ -52,6 +52,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
public: public:
static ChromeClientImpl* Create(WebViewImpl*); static ChromeClientImpl* Create(WebViewImpl*);
~ChromeClientImpl() override; ~ChromeClientImpl() override;
void Trace(Visitor* visitor) override;
WebViewImpl* GetWebView() const override; WebViewImpl* GetWebView() const override;
...@@ -243,7 +244,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient { ...@@ -243,7 +244,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
WebAutofillClient* AutofillClientFromFrame(LocalFrame*); WebAutofillClient* AutofillClientFromFrame(LocalFrame*);
WebViewImpl* web_view_; // Weak pointer. WebViewImpl* web_view_; // Weak pointer.
Vector<PopupOpeningObserver*> popup_opening_observers_; HeapVector<Member<PopupOpeningObserver>> popup_opening_observers_;
Cursor last_set_mouse_cursor_for_testing_; Cursor last_set_mouse_cursor_for_testing_;
bool cursor_overridden_; bool cursor_overridden_;
bool did_request_non_empty_tool_tip_; bool did_request_non_empty_tool_tip_;
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_POPUP_OPENING_OBSERVER_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_POPUP_OPENING_OBSERVER_H_
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
namespace blink { namespace blink {
class CORE_EXPORT PopupOpeningObserver { class CORE_EXPORT PopupOpeningObserver : public GarbageCollectedMixin {
public: public:
virtual void WillOpenPopup() = 0; virtual void WillOpenPopup() = 0;
......
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