diff options
author | cmasone@chromium.org <cmasone@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 06:34:59 +0000 |
---|---|---|
committer | cmasone@chromium.org <cmasone@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-31 06:34:59 +0000 |
commit | e282490e359a536c91b15c9a9023cc798fab303b (patch) | |
tree | 1dfee9533ded06413b5b713f246a317a67c47ddd /dbus/test_service.cc | |
parent | 6bedbeffa4fa25ba16d50253dcc7c1aec5ac4702 (diff) | |
download | chromium_src-e282490e359a536c91b15c9a9023cc798fab303b.zip chromium_src-e282490e359a536c91b15c9a9023cc798fab303b.tar.gz chromium_src-e282490e359a536c91b15c9a9023cc798fab303b.tar.bz2 |
Allow Chromium's DBus service ownership to be stealable
We've seen some cases in tests where a Chromium process winds up in a
temporarily unkillable state, causing the dbus-daemon to believe that
it still actively owns org.chromium.LibCrosService. This makes
attempts to restart the UI fail, as the browser dies when it cannot
take ownership of this service name. The reason it can't is because
Chromium currently doesn't allow other processes to steal ownership --
and the unkillable process is holding onto the token.
This can be remedied by providing certain options when ownership of
the service name is taken, options that allow other processes to seize
ownership if they so choose. The ramifications of this are discussed
further in the bug.
BUG=chromium:261381
TEST=new unit test in dbus_unittest
TEST=run the following as chronos on a device: "gdbus call --system --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.RequestName org.chromium.LibCrosService 7"
TEST=This should return (uint32 1,)
Review URL: https://chromiumcodereview.appspot.com/20555003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/test_service.cc')
-rw-r--r-- | dbus/test_service.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dbus/test_service.cc b/dbus/test_service.cc index ae67bf7..5f59501 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))); |