Commit 5bb50560 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[MessageLoop]: Replace RunLoop-related ScopedNestableTaskAllower in /content/public/test.

This CL replaces ScopedNestableTaskAllower with kNestableTasksAllowed passed
as argument to the RunLoop involved if any.
Only native nested loops should use ScopedNestableTaskAllower (soon to be deprecated).
For more details, see:
https://cs.chromium.org/chromium/src/base/message_loop/message_loop_current.h?sq=package:chromium&dr=CSs&g=0&l=159

A small step towards deleting MessageLoop.

This CL was generated with git cl split.
Refer to the top-level CL if necessary :
https://chromium-review.googlesource.com/c/chromium/src/+/1635819

Please CQ if LGTY!

This CL was uploaded by git cl split.

R=tommi@chromium.org

Bug: 766678
Change-Id: I5169a00876479db55907237bc3b7dc339f463bb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635825
Auto-Submit: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: default avatarTommi <tommi@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666203}
parent cff7f4b2
......@@ -439,7 +439,7 @@ void BrowserTestBase::SimulateNetworkServiceCrash() {
ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
mojom::kNetworkServiceName, &network_service_test);
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
base::RunLoop run_loop{base::RunLoop::Type::kNestableTasksAllowed};
network_service_test.set_connection_error_handler(run_loop.QuitClosure());
network_service_test->SimulateCrash();
......@@ -631,12 +631,10 @@ void BrowserTestBase::InitializeNetworkProcess() {
ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
mojom::kNetworkServiceName, &network_service_test);
// Allow nested tasks so that the mojo reply is dispatched.
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
// Send the DNS rules to network service process. Android needs the RunLoop
// to dispatch a Java callback that makes network process to enter native
// code.
base::RunLoop loop;
base::RunLoop loop{base::RunLoop::Type::kNestableTasksAllowed};
network_service_test->AddRules(std::move(mojo_rules), loop.QuitClosure());
loop.Run();
}
......
......@@ -1844,7 +1844,7 @@ void SetupCrossSiteRedirector(net::EmbeddedTestServer* embedded_test_server) {
void WaitForInterstitialAttach(content::WebContents* web_contents) {
if (web_contents->ShowingInterstitialPage())
return;
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
base::RunLoop run_loop{base::RunLoop::Type::kNestableTasksAllowed};
InterstitialObserver observer(web_contents, run_loop.QuitClosure(),
base::OnceClosure());
run_loop.Run();
......@@ -2246,7 +2246,7 @@ bool DOMMessageQueue::WaitForMessage(std::string* message) {
DCHECK(message);
if (!renderer_crashed_ && message_queue_.empty()) {
// This will be quit when a new message comes in.
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
base::RunLoop run_loop{base::RunLoop::Type::kNestableTasksAllowed};
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
}
......@@ -2423,7 +2423,7 @@ void RenderFrameSubmissionObserver::Quit() {
}
void RenderFrameSubmissionObserver::Wait() {
base::RunLoop run_loop;
base::RunLoop run_loop{base::RunLoop::Type::kNestableTasksAllowed};
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
}
......
......@@ -28,7 +28,7 @@ class FrameLoadWaiter : public RenderFrameObserver {
void DidFinishLoad() override;
void OnDestruct() override;
base::RunLoop run_loop_;
base::RunLoop run_loop_{base::RunLoop::Type::kNestableTasksAllowed};
bool did_load_ = false;
DISALLOW_COPY_AND_ASSIGN(FrameLoadWaiter);
......
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