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

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

Issue 12092061: Code cleaning: Uses scoped_ptr<> to express ownership rather than writing ownership in comments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added chrome/browser/password_manager/native_backend_kwallet_x_unitte\ Created 7 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) 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 #ifndef CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_ 5 #ifndef CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_
6 #define CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_ 6 #define CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "chromeos/chromeos_export.h" 10 #include "chromeos/chromeos_export.h"
11 #include "dbus/message.h"
11 12
12 namespace dbus { 13 namespace dbus {
13 14
14 class Bus; 15 class Bus;
15 class ObjectProxy; 16 class ObjectProxy;
16 class MethodCall;
17 class Response;
18 17
19 } // namespace dbus 18 } // namespace dbus
20 19
21 namespace chromeos { 20 namespace chromeos {
22 21
23 // A utility class to call D-Bus methods in a synchronous (blocking) way. 22 // A utility class to call D-Bus methods in a synchronous (blocking) way.
24 // Note: Blocking the thread until it returns is not a good idea in most cases. 23 // Note: Blocking the thread until it returns is not a good idea in most cases.
25 // Avoid using this class as hard as you can. 24 // Avoid using this class as hard as you can.
26 class CHROMEOS_EXPORT BlockingMethodCaller { 25 class CHROMEOS_EXPORT BlockingMethodCaller {
27 public: 26 public:
28 BlockingMethodCaller(dbus::Bus* bus, dbus::ObjectProxy* proxy); 27 BlockingMethodCaller(dbus::Bus* bus, dbus::ObjectProxy* proxy);
29 virtual ~BlockingMethodCaller(); 28 virtual ~BlockingMethodCaller();
30 29
31 // Calls the method and blocks until it returns. 30 // Calls the method and blocks until it returns.
32 // The caller is responsible to delete the returned object. 31 scoped_ptr<dbus::Response> CallMethodAndBlock(dbus::MethodCall* method_call);
33 dbus::Response* CallMethodAndBlock(dbus::MethodCall* method_call);
34 32
35 private: 33 private:
36 dbus::Bus* bus_; 34 dbus::Bus* bus_;
37 dbus::ObjectProxy* proxy_; 35 dbus::ObjectProxy* proxy_;
38 base::WaitableEvent on_blocking_method_call_; 36 base::WaitableEvent on_blocking_method_call_;
39 37
40 DISALLOW_COPY_AND_ASSIGN(BlockingMethodCaller); 38 DISALLOW_COPY_AND_ASSIGN(BlockingMethodCaller);
41 }; 39 };
42 40
43 } // namespace chromeos 41 } // namespace chromeos
44 42
45 #endif // CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_ 43 #endif // CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc ('k') | chromeos/dbus/blocking_method_caller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698