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

Unified Diff: dbus/test_service.cc

Issue 20555003: Allow Chromium's DBus service ownership to be stealable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nits Created 7 years, 5 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 ae67bf72794306896b2f0ea29f287a29a0371c7a..5f5950162ec95493ed86176cfcbf5cc93101ef73 100644
--- a/dbus/test_service.cc
+++ b/dbus/test_service.cc
@@ -27,7 +27,8 @@ namespace dbus {
// GetManagedObjects.
const int TestService::kNumMethodsToExport = 9;
-TestService::Options::Options() {
+TestService::Options::Options()
+ : request_ownership_options(Bus::REQUIRE_PRIMARY) {
}
TestService::Options::~Options() {
@@ -35,6 +36,7 @@ TestService::Options::~Options() {
TestService::TestService(const Options& options)
: base::Thread("TestService"),
+ request_ownership_options_(options.request_ownership_options),
dbus_task_runner_(options.dbus_task_runner),
on_all_methods_exported_(false, false),
num_exported_methods_(0) {
@@ -103,6 +105,7 @@ void TestService::SendTestSignalFromRootInternal(const std::string& message) {
writer.AppendString(message);
bus_->RequestOwnership("org.chromium.TestService",
+ request_ownership_options_,
base::Bind(&TestService::OnOwnership,
base::Unretained(this),
base::Bind(&EmptyCallback)));
@@ -123,6 +126,7 @@ void TestService::RequestOwnership(base::Callback<void(bool)> callback) {
void TestService::RequestOwnershipInternal(
base::Callback<void(bool)> callback) {
bus_->RequestOwnership("org.chromium.TestService",
+ request_ownership_options_,
base::Bind(&TestService::OnOwnership,
base::Unretained(this),
callback));
@@ -160,6 +164,7 @@ void TestService::Run(base::MessageLoop* message_loop) {
bus_ = new Bus(bus_options);
bus_->RequestOwnership("org.chromium.TestService",
+ request_ownership_options_,
base::Bind(&TestService::OnOwnership,
base::Unretained(this),
base::Bind(&EmptyCallback)));
« 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