blob: 13dc6d0362d5bd4dffee2f56285b3a17d79bfeb1 [file] [log] [blame]
haraken11567072015-06-26 02:03:071// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "extensions/renderer/scoped_web_frame.h"
6
Daniel Cheng9a7c6c82020-04-25 04:58:177#include "mojo/public/cpp/bindings/associated_remote.h"
Miyoung Shin2be9da72019-09-04 09:04:108#include "mojo/public/cpp/bindings/pending_remote.h"
Minoru Chikamunee9eb7f92020-10-26 04:15:169#include "third_party/blink/public/platform/scheduler/web_agent_group_scheduler.h"
10#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h"
Blink Reformata30d4232018-04-07 15:31:0611#include "third_party/blink/public/web/web_heap.h"
danakj763c2402018-11-09 02:46:2212#include "third_party/blink/public/web/web_view.h"
13#include "third_party/blink/public/web/web_widget.h"
haraken11567072015-06-26 02:03:0714
15namespace extensions {
16
Daniel Chengd5e56ff2017-06-24 07:44:0217ScopedWebFrame::ScopedWebFrame()
Minoru Chikamunee9eb7f92020-10-26 04:15:1618 : agent_group_scheduler_(
19 blink::scheduler::WebAgentGroupScheduler::CreateForTesting()),
20 view_(blink::WebView::Create(
21 /*client=*/nullptr,
22 /*is_hidden=*/false,
23 /*is_inside_portal=*/false,
24 /*compositing_enabled=*/false,
25 /*opener=*/nullptr,
26 mojo::NullAssociatedReceiver(),
27 *agent_group_scheduler_)),
Dave Tapuska84449382020-05-01 00:39:0428 frame_(blink::WebLocalFrame::CreateMainFrame(
29 view_,
30 &frame_client_,
31 nullptr,
32 base::UnguessableToken::Create(),
33 nullptr)) {}
haraken11567072015-06-26 02:03:0734
35ScopedWebFrame::~ScopedWebFrame() {
Erik Chenfe2adc32019-08-23 18:10:2236 view_->Close();
Blink Reformat1c4d759e2017-04-09 16:34:5437 blink::WebHeap::CollectAllGarbageForTesting();
Minoru Chikamunee9eb7f92020-10-26 04:15:1638 agent_group_scheduler_ = nullptr;
haraken11567072015-06-26 02:03:0739}
40
41} // namespace extensions