Commit 1d687adc authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

blink::Page: Move main_frame declaration

Page::main_frame_ is used during constructing Page::visual_viewport_
(VisualViewport) which imples that the field should be constructed
before using.

allocatd memory.

Note: In practice this works because Oilpan currently 0-fills all newly
Change-Id: I103d90c17d649dffbce2c9ac70a0a6a9cac9448b
Reviewed-on: https://chromium-review.googlesource.com/1133159Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574139}
parent da210dc6
......@@ -145,6 +145,7 @@ Page* Page::CreateOrdinary(PageClients& page_clients, Page* opener) {
Page::Page(PageClients& page_clients)
: SettingsDelegate(Settings::Create()),
main_frame_(nullptr),
animator_(PageAnimator::Create(*this)),
autoscroll_controller_(AutoscrollController::Create(*this)),
chrome_client_(page_clients.chrome_client),
......@@ -161,7 +162,6 @@ Page::Page(PageClients& page_clients)
visual_viewport_(VisualViewport::Create(*this)),
overscroll_controller_(
OverscrollController::Create(GetVisualViewport(), GetChromeClient())),
main_frame_(nullptr),
plugin_data_(nullptr),
opened_by_dom_(false),
tab_key_cycles_through_elements_(true),
......
......@@ -332,6 +332,20 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
void SetPageScheduler(std::unique_ptr<PageScheduler>);
// Typically, the main frame and Page should both be owned by the embedder,
// which must call Page::willBeDestroyed() prior to destroying Page. This
// call detaches the main frame and clears this pointer, thus ensuring that
// this field only references a live main frame.
//
// However, there are several locations (InspectorOverlay, SVGImage, and
// WebPagePopupImpl) which don't hold a reference to the main frame at all
// after creating it. These are still safe because they always create a
// Frame with a LocalFrameView. LocalFrameView and Frame hold references to
// each other, thus keeping each other alive. The call to willBeDestroyed()
// breaks this cycle, so the frame is still properly destroyed once no
// longer needed.
Member<Frame> main_frame_;
Member<PageAnimator> animator_;
const Member<AutoscrollController> autoscroll_controller_;
Member<ChromeClient> chrome_client_;
......@@ -350,20 +364,6 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
const Member<VisualViewport> visual_viewport_;
const Member<OverscrollController> overscroll_controller_;
// Typically, the main frame and Page should both be owned by the embedder,
// which must call Page::willBeDestroyed() prior to destroying Page. This
// call detaches the main frame and clears this pointer, thus ensuring that
// this field only references a live main frame.
//
// However, there are several locations (InspectorOverlay, SVGImage, and
// WebPagePopupImpl) which don't hold a reference to the main frame at all
// after creating it. These are still safe because they always create a
// Frame with a LocalFrameView. LocalFrameView and Frame hold references to
// each other, thus keeping each other alive. The call to willBeDestroyed()
// breaks this cycle, so the frame is still properly destroyed once no
// longer needed.
Member<Frame> main_frame_;
Member<PluginData> plugin_data_;
Member<ValidationMessageClient> validation_message_client_;
......
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