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

Side by Side Diff: dbus/bus.cc

Issue 2082653002: Use ThreadTaskRunnerHandle::Get() in dbus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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 "dbus/bus.h" 5 #include "dbus/bus.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "dbus/exported_object.h" 18 #include "dbus/exported_object.h"
18 #include "dbus/message.h" 19 #include "dbus/message.h"
19 #include "dbus/object_manager.h" 20 #include "dbus/object_manager.h"
20 #include "dbus/object_path.h" 21 #include "dbus/object_path.h"
21 #include "dbus/object_proxy.h" 22 #include "dbus/object_proxy.h"
22 #include "dbus/scoped_dbus_error.h" 23 #include "dbus/scoped_dbus_error.h"
23 24
24 namespace dbus { 25 namespace dbus {
25 26
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 origin_thread_id_(base::PlatformThread::CurrentId()), 196 origin_thread_id_(base::PlatformThread::CurrentId()),
196 async_operations_set_up_(false), 197 async_operations_set_up_(false),
197 shutdown_completed_(false), 198 shutdown_completed_(false),
198 num_pending_watches_(0), 199 num_pending_watches_(0),
199 num_pending_timeouts_(0), 200 num_pending_timeouts_(0),
200 address_(options.address) { 201 address_(options.address) {
201 // This is safe to call multiple times. 202 // This is safe to call multiple times.
202 dbus_threads_init_default(); 203 dbus_threads_init_default();
203 // The origin message loop is unnecessary if the client uses synchronous 204 // The origin message loop is unnecessary if the client uses synchronous
204 // functions only. 205 // functions only.
205 if (base::MessageLoop::current()) 206 if (base::ThreadTaskRunnerHandle::IsSet())
206 origin_task_runner_ = base::MessageLoop::current()->task_runner(); 207 origin_task_runner_ = base::ThreadTaskRunnerHandle::Get();
207 } 208 }
208 209
209 Bus::~Bus() { 210 Bus::~Bus() {
210 DCHECK(!connection_); 211 DCHECK(!connection_);
211 DCHECK(owned_service_names_.empty()); 212 DCHECK(owned_service_names_.empty());
212 DCHECK(match_rules_added_.empty()); 213 DCHECK(match_rules_added_.empty());
213 DCHECK(filter_functions_added_.empty()); 214 DCHECK(filter_functions_added_.empty());
214 DCHECK(registered_object_paths_.empty()); 215 DCHECK(registered_object_paths_.empty());
215 DCHECK_EQ(0, num_pending_watches_); 216 DCHECK_EQ(0, num_pending_watches_);
216 // TODO(satorux): This check fails occasionally in browser_tests for tests 217 // TODO(satorux): This check fails occasionally in browser_tests for tests
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 kNameOwnerChangedSignal)) { 1216 kNameOwnerChangedSignal)) {
1216 Bus* self = static_cast<Bus*>(data); 1217 Bus* self = static_cast<Bus*>(data);
1217 self->OnServiceOwnerChanged(message); 1218 self->OnServiceOwnerChanged(message);
1218 } 1219 }
1219 // Always return unhandled to let others, e.g. ObjectProxies, handle the same 1220 // Always return unhandled to let others, e.g. ObjectProxies, handle the same
1220 // signal. 1221 // signal.
1221 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 1222 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
1222 } 1223 }
1223 1224
1224 } // namespace dbus 1225 } // namespace dbus
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698