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

Side by Side Diff: chrome/browser/chromeos/dbus/cros_dbus_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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chromeos/dbus/ibus/ibus_panel_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" 5 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/chromeos/chromeos_version.h" 8 #include "base/chromeos/chromeos_version.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Starts the D-Bus service. 42 // Starts the D-Bus service.
43 void Start() { 43 void Start() {
44 // Make sure we're running on the origin thread (i.e. the UI thread in 44 // Make sure we're running on the origin thread (i.e. the UI thread in
45 // production). 45 // production).
46 DCHECK(OnOriginThread()); 46 DCHECK(OnOriginThread());
47 47
48 // Return if the service has been already started. 48 // Return if the service has been already started.
49 if (service_started_) 49 if (service_started_)
50 return; 50 return;
51 51
52 // There are some situations, described in http://crbug.com/234382#c27,
53 // where processes on Linux can wind up stuck in an uninterruptible state
54 // for tens of seconds. If this happens when Chrome is trying to exit,
55 // this unkillable process can wind up clinging to ownership of
56 // kLibCrosServiceName while the system is trying to restart the browser.
57 // This leads to a fatal situation if we don't allow the new browser
58 // instance to replace the old as the owner of kLibCrosServiceName as seen
59 // in http://crbug.com/234382. Hence, REQUIRE_PRIMARY_ALLOW_REPLACEMENT.
52 bus_->RequestOwnership(kLibCrosServiceName, 60 bus_->RequestOwnership(kLibCrosServiceName,
61 dbus::Bus::REQUIRE_PRIMARY_ALLOW_REPLACEMENT,
53 base::Bind(&CrosDBusServiceImpl::OnOwnership, 62 base::Bind(&CrosDBusServiceImpl::OnOwnership,
54 base::Unretained(this))); 63 base::Unretained(this)));
55 64
56 exported_object_ = bus_->GetExportedObject( 65 exported_object_ = bus_->GetExportedObject(
57 dbus::ObjectPath(kLibCrosServicePath)); 66 dbus::ObjectPath(kLibCrosServicePath));
58 67
59 for (size_t i = 0; i < service_providers_.size(); ++i) 68 for (size_t i = 0; i < service_providers_.size(); ++i)
60 service_providers_[i]->Start(exported_object_); 69 service_providers_[i]->Start(exported_object_);
61 70
62 service_started_ = true; 71 service_started_ = true;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 VLOG(1) << "CrosDBusService Shutdown completed"; 154 VLOG(1) << "CrosDBusService Shutdown completed";
146 } 155 }
147 156
148 CrosDBusService::~CrosDBusService() { 157 CrosDBusService::~CrosDBusService() {
149 } 158 }
150 159
151 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() { 160 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() {
152 } 161 }
153 162
154 } // namespace chromeos 163 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/ibus/ibus_panel_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698