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

Side by Side Diff: chromeos/dbus/blocking_method_caller.cc

Issue 24554002: dbus: Replace PostTaskTo*Thread methods with Get*TaskRunner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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/blocking_method_caller_unittest.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 "chromeos/dbus/blocking_method_caller.h" 5 #include "chromeos/dbus/blocking_method_caller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/task_runner.h"
10 #include "base/threading/thread_restrictions.h" 11 #include "base/threading/thread_restrictions.h"
11 #include "dbus/bus.h" 12 #include "dbus/bus.h"
12 #include "dbus/object_proxy.h" 13 #include "dbus/object_proxy.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
15 16
16 namespace { 17 namespace {
17 18
18 // This function is a part of CallMethodAndBlock implementation. 19 // This function is a part of CallMethodAndBlock implementation.
19 void CallMethodAndBlockInternal( 20 void CallMethodAndBlockInternal(
(...skipping 22 matching lines...) Expand all
42 dbus::MethodCall* method_call) { 43 dbus::MethodCall* method_call) {
43 // on_blocking_method_call_->Signal() will be called when |signaler| is 44 // on_blocking_method_call_->Signal() will be called when |signaler| is
44 // destroyed. 45 // destroyed.
45 base::Closure signal_task( 46 base::Closure signal_task(
46 base::Bind(&base::WaitableEvent::Signal, 47 base::Bind(&base::WaitableEvent::Signal,
47 base::Unretained(&on_blocking_method_call_))); 48 base::Unretained(&on_blocking_method_call_)));
48 base::ScopedClosureRunner* signaler = 49 base::ScopedClosureRunner* signaler =
49 new base::ScopedClosureRunner(signal_task); 50 new base::ScopedClosureRunner(signal_task);
50 51
51 scoped_ptr<dbus::Response> response; 52 scoped_ptr<dbus::Response> response;
52 bus_->PostTaskToDBusThread( 53 bus_->GetDBusTaskRunner()->PostTask(
53 FROM_HERE, 54 FROM_HERE,
54 base::Bind(&CallMethodAndBlockInternal, 55 base::Bind(&CallMethodAndBlockInternal,
55 &response, 56 &response,
56 base::Owned(signaler), 57 base::Owned(signaler),
57 base::Unretained(proxy_), 58 base::Unretained(proxy_),
58 method_call)); 59 method_call));
59 // http://crbug.com/125360 60 // http://crbug.com/125360
60 base::ThreadRestrictions::ScopedAllowWait allow_wait; 61 base::ThreadRestrictions::ScopedAllowWait allow_wait;
61 on_blocking_method_call_.Wait(); 62 on_blocking_method_call_.Wait();
62 return response.Pass(); 63 return response.Pass();
63 } 64 }
64 65
65 } // namespace chromeos 66 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/blocking_method_caller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698