Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: dbus/test_service.cc

Issue 7830009: Add Bus::ShutdownOnDBusThreadAndBlock() and remove bus::Shutdown() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/test_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/test_service.cc
diff --git a/dbus/test_service.cc b/dbus/test_service.cc
index acab607ed13dead87319a1b45ef8c754799c87ef..1b8b9bff24951b358490e18577129fcdcfe9017d 100644
--- a/dbus/test_service.cc
+++ b/dbus/test_service.cc
@@ -26,7 +26,6 @@ TestService::Options::~Options() {
TestService::TestService(const Options& options)
: base::Thread("TestService"),
dbus_thread_(options.dbus_thread),
- on_shutdown_(false /* manual_reset */, false /* initially_signaled */),
on_all_methods_exported_(false, false),
num_exported_methods_(0) {
}
@@ -48,24 +47,24 @@ bool TestService::WaitUntilServiceIsStarted() {
return on_all_methods_exported_.TimedWait(timeout);
}
-void TestService::Shutdown() {
+void TestService::ShutdownAndBlock() {
message_loop()->PostTask(
FROM_HERE,
- base::Bind(&TestService::ShutdownInternal,
+ base::Bind(&TestService::ShutdownAndBlockInternal,
base::Unretained(this)));
}
-bool TestService::WaitUntilServiceIsShutdown() {
- const base::TimeDelta timeout(
- base::TimeDelta::FromMilliseconds(
- TestTimeouts::action_max_timeout_ms()));
- return on_shutdown_.TimedWait(timeout);
-}
-
bool TestService::HasDBusThread() {
return bus_->HasDBusThread();
}
+void TestService::ShutdownAndBlockInternal() {
+ if (HasDBusThread())
+ bus_->ShutdownOnDBusThreadAndBlock();
+ else
+ bus_->ShutdownAndBlock();
+}
+
void TestService::SendTestSignal(const std::string& message) {
message_loop()->PostTask(
FROM_HERE,
@@ -81,11 +80,6 @@ void TestService::SendTestSignalInternal(const std::string& message) {
exported_object_->SendSignal(&signal);
}
-void TestService::ShutdownInternal() {
- bus_->Shutdown(base::Bind(&TestService::OnShutdown,
- base::Unretained(this)));
-}
-
void TestService::OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {
@@ -102,10 +96,6 @@ void TestService::OnExported(const std::string& interface_name,
on_all_methods_exported_.Signal();
}
-void TestService::OnShutdown() {
- on_shutdown_.Signal();
-}
-
void TestService::Run(MessageLoop* message_loop) {
Bus::Options bus_options;
bus_options.bus_type = Bus::SESSION;
« no previous file with comments | « dbus/test_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698