Skip to content

Commit

Permalink
Don't use base::MessageLoop::{Quit,QuitClosure} in mojo/
Browse files Browse the repository at this point in the history
This patch renames base::MessageLoop::{Quit,QuitClosure} to
base::MessageLoop::{QuitWhenIdle,QuitWhenIdleClosure}.

BUG=131220
TEST=
R=sky@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#353587}
  • Loading branch information
k15tfu authored and Commit bot committed Oct 12, 2015
1 parent 2a03078 commit f8812d5
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 20 deletions.
3 changes: 1 addition & 2 deletions mojo/android/javatests/mojo_test_case.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ static void RunLoop(JNIEnv* env,
base::RunLoop run_loop;
if (timeout_ms) {
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::MessageLoop::QuitClosure(),
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
base::TimeDelta::FromMilliseconds(timeout_ms));
run_loop.Run();
} else {
Expand Down
2 changes: 1 addition & 1 deletion mojo/android/system/base_run_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void RunUntilIdle(JNIEnv* env,
static void Quit(JNIEnv* env,
const JavaParamRef<jobject>& jcaller,
jlong runLoopID) {
reinterpret_cast<base::MessageLoop*>(runLoopID)->Quit();
reinterpret_cast<base::MessageLoop*>(runLoopID)->QuitWhenIdle();
}

static void RunJavaRunnable(
Expand Down
2 changes: 1 addition & 1 deletion mojo/application/public/cpp/lib/application_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace {
void DefaultTerminationClosure() {
if (base::MessageLoop::current() &&
base::MessageLoop::current()->is_running())
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}

} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DummyLoader : public shell::ApplicationLoader {
void Load(const GURL& url,
InterfaceRequest<Application> application_request) override {
if (simulate_app_quit_)
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}

void DontSimulateAppQuit() { simulate_app_quit_ = false; }
Expand Down
4 changes: 2 additions & 2 deletions mojo/runner/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void Context::Shutdown() {
void Context::OnShutdownComplete() {
DCHECK_EQ(base::MessageLoop::current()->task_runner(),
task_runners_->shell_runner());
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}

void Context::Run(const GURL& url) {
Expand Down Expand Up @@ -302,7 +302,7 @@ void Context::OnApplicationEnd(const GURL& url) {
DCHECK_EQ(base::MessageLoop::current()->task_runner(),
task_runners_->shell_runner());
if (app_complete_callback_.is_null()) {
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
} else {
app_complete_callback_.Run();
}
Expand Down
2 changes: 1 addition & 1 deletion mojo/runner/native_runner_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TestNativeRunner : public shell::NativeRunner {
~TestNativeRunner() override {
state_->runner_was_destroyed = true;
if (base::MessageLoop::current()->is_running())
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}
void Start(const base::FilePath& app_path,
bool start_sandboxed,
Expand Down
8 changes: 4 additions & 4 deletions mojo/runner/shell_apptest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ TEST_F(ShellHTTPAppTest, Http) {
EXPECT_EQ(GetURL("app"), app_url);
EXPECT_EQ(GetURL("app"), connection_url);
EXPECT_EQ("hello", message);
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
});
base::RunLoop().Run();
}
Expand All @@ -140,7 +140,7 @@ TEST_F(ShellHTTPAppTest, Redirect) {
EXPECT_EQ(GetURL("app"), app_url);
EXPECT_EQ(GetURL("app"), connection_url);
EXPECT_EQ("hello", message);
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
});
base::RunLoop().Run();
}
Expand Down Expand Up @@ -169,7 +169,7 @@ TEST_F(ShellHTTPAppTest, MAYBE_QueryHandling) {
EXPECT_EQ(GetURL("app?foo"), connection_url);
} else if (num_responses == 2) {
EXPECT_EQ(GetURL("app?bar"), connection_url);
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
} else {
CHECK(false);
}
Expand All @@ -189,7 +189,7 @@ TEST_F(ShellAppTest, MojoURLQueryHandling) {
base::CompareCase::SENSITIVE));
EXPECT_EQ(app_url.To<std::string>() + "?foo", connection_url);
EXPECT_EQ("hello", message);
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
};
pingable->Ping("hello", callback);
base::RunLoop().Run();
Expand Down
2 changes: 1 addition & 1 deletion mojo/services/test_service/test_service_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void TestServiceApplication::ReleaseRef() {
assert(ref_count_ > 0);
ref_count_--;
if (ref_count_ <= 0)
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}

} // namespace test
Expand Down
10 changes: 5 additions & 5 deletions mojo/shell/application_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TestServiceImpl : public TestService {
--context_->num_impls;
if (!base::MessageLoop::current()->is_running())
return;
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}

// TestService implementation:
Expand All @@ -76,7 +76,7 @@ class TestClient {

void AckTest() {
if (quit_after_ack_)
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
}

void Test(const std::string& test_string) {
Expand Down Expand Up @@ -268,7 +268,7 @@ class TestAImpl : public TestA {
}

void Quit() {
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
test_context_->set_a_called_quit();
test_context_->QuitSoon();
}
Expand All @@ -291,7 +291,7 @@ class TestBImpl : public TestB {
~TestBImpl() override {
test_context_->IncrementNumBDeletes();
if (base::MessageLoop::current()->is_running())
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
test_context_->QuitSoon();
}

Expand Down Expand Up @@ -351,7 +351,7 @@ class Tester : public ApplicationDelegate,
requestor_url_ != connection->GetRemoteApplicationURL()) {
context_->set_tester_called_quit();
context_->QuitSoon();
base::MessageLoop::current()->Quit();
base::MessageLoop::current()->QuitWhenIdle();
return false;
}
// If we're coming from A, then add B, otherwise A.
Expand Down
4 changes: 2 additions & 2 deletions mojo/shell/capability_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class ConnectionValidator : public ApplicationLoader,
if (i != expectations_.end()) {
expectations_.erase(i);
if (expectations_.empty())
loop_->Quit();
loop_->QuitWhenIdle();
} else {
// This is a test failure, and will result in PrintUnexpectedExpecations()
// being called.
unexpected_.insert(result);
loop_->Quit();
loop_->QuitWhenIdle();
}
}

Expand Down

0 comments on commit f8812d5

Please sign in to comment.