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

Side by Side Diff: chrome/browser/chromeos/dbus/cros_dbus_service.cc

Issue 9363045: Revert 121920 - dbus: add ObjectPath type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h" 9 #include "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h"
10 #include "chrome/browser/chromeos/system/runtime_environment.h" 10 #include "chrome/browser/chromeos/system/runtime_environment.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "dbus/bus.h" 12 #include "dbus/bus.h"
13 #include "dbus/exported_object.h" 13 #include "dbus/exported_object.h"
14 #include "dbus/object_path.h"
15 #include "third_party/cros_system_api/dbus/service_constants.h" 14 #include "third_party/cros_system_api/dbus/service_constants.h"
16 15
17 namespace chromeos { 16 namespace chromeos {
18 17
19 // The CrosDBusService implementation used in production, and unit tests. 18 // The CrosDBusService implementation used in production, and unit tests.
20 class CrosDBusServiceImpl : public CrosDBusService { 19 class CrosDBusServiceImpl : public CrosDBusService {
21 public: 20 public:
22 explicit CrosDBusServiceImpl(dbus::Bus* bus) 21 explicit CrosDBusServiceImpl(dbus::Bus* bus)
23 : service_started_(false), 22 : service_started_(false),
24 origin_thread_id_(base::PlatformThread::CurrentId()), 23 origin_thread_id_(base::PlatformThread::CurrentId()),
25 bus_(bus) { 24 bus_(bus) {
26 } 25 }
27 26
28 virtual ~CrosDBusServiceImpl() { 27 virtual ~CrosDBusServiceImpl() {
29 STLDeleteElements(&service_providers_); 28 STLDeleteElements(&service_providers_);
30 } 29 }
31 30
32 // CrosDBusService override. 31 // CrosDBusService override.
33 virtual void Start() { 32 virtual void Start() {
34 // Make sure we're running on the origin thread (i.e. the UI thread in 33 // Make sure we're running on the origin thread (i.e. the UI thread in
35 // production). 34 // production).
36 DCHECK(OnOriginThread()); 35 DCHECK(OnOriginThread());
37 36
38 // Return if the service has been already started. 37 // Return if the service has been already started.
39 if (service_started_) 38 if (service_started_)
40 return; 39 return;
41 40
42 exported_object_ = bus_->GetExportedObject( 41 exported_object_ = bus_->GetExportedObject(
43 kLibCrosServiceName, 42 kLibCrosServiceName,
44 dbus::ObjectPath(kLibCrosServicePath)); 43 kLibCrosServicePath);
45 44
46 for (size_t i = 0; i < service_providers_.size(); ++i) 45 for (size_t i = 0; i < service_providers_.size(); ++i)
47 service_providers_[i]->Start(exported_object_); 46 service_providers_[i]->Start(exported_object_);
48 47
49 service_started_ = true; 48 service_started_ = true;
50 49
51 VLOG(1) << "CrosDBusServiceImpl started."; 50 VLOG(1) << "CrosDBusServiceImpl started.";
52 } 51 }
53 52
54 // Registers a service provider. This must be done before Start(). 53 // Registers a service provider. This must be done before Start().
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return service; 106 return service;
108 } 107 }
109 108
110 CrosDBusService::~CrosDBusService() { 109 CrosDBusService::~CrosDBusService() {
111 } 110 }
112 111
113 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() { 112 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() {
114 } 113 }
115 114
116 } // namespace chromeos 115 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dbus/bluetooth_manager_client.cc ('k') | chrome/browser/chromeos/dbus/cros_dbus_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698