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

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

Issue 9838085: Move files inside chrome/browser/chromeos/dbus to chromeos/dbus (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 years, 8 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 | « chromeos/dbus/DEPS ('k') | chromeos/dbus/blocking_method_caller.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 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_ 5 #ifndef CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_ 6 #define CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "chromeos/chromeos_export.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 MethodCall;
17 class Response; 18 class Response;
18 19
19 } // namespace dbus 20 } // namespace dbus
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 // A utility class to call D-Bus methods in a synchronous (blocking) way. 24 // 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. 25 // 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. 26 // Avoid using this class as hard as you can.
26 class BlockingMethodCaller { 27 class CHROMEOS_EXPORT BlockingMethodCaller {
27 public: 28 public:
28 BlockingMethodCaller(dbus::Bus* bus, dbus::ObjectProxy* proxy); 29 BlockingMethodCaller(dbus::Bus* bus, dbus::ObjectProxy* proxy);
29 virtual ~BlockingMethodCaller(); 30 virtual ~BlockingMethodCaller();
30 31
31 // Calls the method and blocks until it returns. 32 // Calls the method and blocks until it returns.
32 // The caller is responsible to delete the returned object. 33 // The caller is responsible to delete the returned object.
33 dbus::Response* CallMethodAndBlock(dbus::MethodCall* method_call); 34 dbus::Response* CallMethodAndBlock(dbus::MethodCall* method_call);
34 35
35 private: 36 private:
36 dbus::Bus* bus_; 37 dbus::Bus* bus_;
37 dbus::ObjectProxy* proxy_; 38 dbus::ObjectProxy* proxy_;
38 base::WaitableEvent on_blocking_method_call_; 39 base::WaitableEvent on_blocking_method_call_;
39 40
40 DISALLOW_COPY_AND_ASSIGN(BlockingMethodCaller); 41 DISALLOW_COPY_AND_ASSIGN(BlockingMethodCaller);
41 }; 42 };
42 43
43 } // namespace chromeos 44 } // namespace chromeos
44 45
45 #endif // CHROME_BROWSER_CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_ 46 #endif // CHROMEOS_DBUS_BLOCKING_METHOD_CALLER_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/DEPS ('k') | chromeos/dbus/blocking_method_caller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698