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

Side by Side Diff: src/cashew_server.h

Issue 5380002: cashew: defer all D-Bus signal processing to main loop (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 10 years, 1 month 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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 SRC_CASHEW_SERVER_H_ 5 #ifndef SRC_CASHEW_SERVER_H_
6 #define SRC_CASHEW_SERVER_H_ 6 #define SRC_CASHEW_SERVER_H_
7 7
8 #include <glib.h>
9
8 #include <map> 10 #include <map>
9 #include <string> 11 #include <string>
10 #include <vector> 12 #include <vector>
11 13
12 #include <base/basictypes.h> // NOLINT 14 #include <base/basictypes.h> // NOLINT
13 #include <dbus-c++/dbus.h> // NOLINT 15 #include <dbus-c++/dbus.h> // NOLINT
14 16
15 #include "src/cashew_server_glue.h" 17 #include "src/cashew_server_glue.h"
16 #include "src/data_plan.h" 18 #include "src/data_plan.h"
17 #include "src/service.h" 19 #include "src/service.h"
18 20
19 namespace cashew { 21 namespace cashew {
20 22
21 class ServiceManager; 23 class ServiceManager;
22 24
23 // Implements Cashew D-Bus API 25 // Implements Cashew D-Bus API
24 class CashewServer : public org::chromium::Cashew_adaptor, 26 class CashewServer : public org::chromium::Cashew_adaptor,
25 public DBus::IntrospectableAdaptor, 27 public DBus::IntrospectableAdaptor,
26 public DBus::ObjectAdaptor { 28 public DBus::ObjectAdaptor {
27 public: 29 public:
28 CashewServer(DBus::Connection& connection, // NOLINT 30 CashewServer(DBus::Connection& connection, // NOLINT
29 ServiceManager * const service_manager); 31 ServiceManager * const service_manager,
32 GMainLoop * const main_loop);
30 virtual ~CashewServer(); 33 virtual ~CashewServer();
31 34
32 // Cashew D-Bus API methods 35 // Cashew D-Bus API methods
33 36
34 // Get data plan info for a cellular service 37 // Get data plan info for a cellular service
35 virtual DBusDataPlanList GetDataPlans(const std::string& service_path, 38 virtual DBusDataPlanList GetDataPlans(const std::string& service_path,
36 DBus::Error& error); // NOLINT 39 DBus::Error& error); // NOLINT
37 40
38 // Request that a DataPlansUpdate signal be sent for a cellular service 41 // Request that a DataPlansUpdate signal be sent for a cellular service
39 virtual void RequestDataPlansUpdate(const std::string& service_path, 42 virtual void RequestDataPlansUpdate(const std::string& service_path,
40 DBus::Error& error); // NOLINT 43 DBus::Error& error); // NOLINT
41 44
42 // Test method to verify that Cashew service is working 45 // Test method to verify that Cashew service is working
43 virtual bool IsAlive(DBus::Error& error); // NOLINT 46 virtual bool IsAlive(DBus::Error& error); // NOLINT
44 47
45 static const char* kServiceName; 48 static const char* kServiceName;
46 static const char* kServicePath; 49 static const char* kServicePath;
47 50
48 // Service Manager methods 51 // Service Manager methods
49 52
50 // Service Manager wants us to emit an update for a Service 53 // Service Manager wants us to emit an update for a Service
51 virtual void EmitDataPlansUpdate(const Service& service); 54 virtual void EmitDataPlansUpdate(const Service& service);
52 55
53 private: 56 private:
54 ServiceManager * const service_manager_; 57 ServiceManager * const service_manager_;
55 58
59 // glib main loop
60 GMainLoop * const main_loop_;
61
56 // Emit a DataPlansUpdate D-Bus signal for a service 62 // Emit a DataPlansUpdate D-Bus signal for a service
57 void EmitDataPlansUpdateSignal(const Service& service); 63 void EmitDataPlansUpdateSignal(const Service& service);
58 64
59 DISALLOW_COPY_AND_ASSIGN(CashewServer); 65 DISALLOW_COPY_AND_ASSIGN(CashewServer);
60 }; 66 };
61 67
62 } // namespace cashew 68 } // namespace cashew
63 69
64 #endif // SRC_CASHEW_SERVER_H_ 70 #endif // SRC_CASHEW_SERVER_H_
OLDNEW
« no previous file with comments | « src/Makefile.am ('k') | src/cashew_server.cc » ('j') | src/property_changed_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698