OLD | NEW |
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 #include <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include <base/at_exit.h> | 8 #include <base/at_exit.h> |
9 #include <base/command_line.h> | 9 #include <base/command_line.h> |
10 #include <base/file_util.h> | 10 #include <base/file_util.h> |
11 #include <base/logging.h> | 11 #include <base/logging.h> |
12 #include <base/string_util.h> | 12 #include <base/string_util.h> |
13 #include <gflags/gflags.h> | 13 #include <gflags/gflags.h> |
14 #include <glib.h> | 14 #include <glib.h> |
15 #include <metrics/metrics_library.h> | 15 #include <metrics/metrics_library.h> |
16 #include <sys/types.h> | 16 #include <sys/types.h> |
17 #include <sys/stat.h> | 17 #include <sys/stat.h> |
18 | 18 |
19 #include "update_engine/dbus_constants.h" | 19 #include "update_engine/dbus_constants.h" |
| 20 #include "update_engine/dbus_interface.h" |
20 #include "update_engine/dbus_service.h" | 21 #include "update_engine/dbus_service.h" |
21 #include "update_engine/prefs.h" | 22 #include "update_engine/prefs.h" |
22 #include "update_engine/subprocess.h" | 23 #include "update_engine/subprocess.h" |
23 #include "update_engine/terminator.h" | 24 #include "update_engine/terminator.h" |
24 #include "update_engine/update_attempter.h" | 25 #include "update_engine/update_attempter.h" |
25 #include "update_engine/update_check_scheduler.h" | 26 #include "update_engine/update_check_scheduler.h" |
26 | 27 |
27 extern "C" { | 28 extern "C" { |
28 #include "update_engine/update_engine.dbusserver.h" | 29 #include "update_engine/update_engine.dbusserver.h" |
29 } | 30 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); | 174 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); |
174 | 175 |
175 chromeos_update_engine::Prefs prefs; | 176 chromeos_update_engine::Prefs prefs; |
176 LOG_IF(ERROR, !prefs.Init(FilePath("/var/lib/update_engine/prefs"))) | 177 LOG_IF(ERROR, !prefs.Init(FilePath("/var/lib/update_engine/prefs"))) |
177 << "Failed to initialize preferences."; | 178 << "Failed to initialize preferences."; |
178 | 179 |
179 MetricsLibrary metrics_lib; | 180 MetricsLibrary metrics_lib; |
180 metrics_lib.Init(); | 181 metrics_lib.Init(); |
181 | 182 |
182 // Create the update attempter: | 183 // Create the update attempter: |
| 184 chromeos_update_engine::ConcreteDbusGlib dbus; |
183 chromeos_update_engine::UpdateAttempter update_attempter(&prefs, | 185 chromeos_update_engine::UpdateAttempter update_attempter(&prefs, |
184 &metrics_lib); | 186 &metrics_lib, |
| 187 &dbus); |
185 | 188 |
186 // Create the dbus service object: | 189 // Create the dbus service object: |
187 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE, | 190 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE, |
188 &dbus_glib_update_engine_service_object_info); | 191 &dbus_glib_update_engine_service_object_info); |
189 UpdateEngineService* service = | 192 UpdateEngineService* service = |
190 UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); | 193 UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); |
191 service->update_attempter_ = &update_attempter; | 194 service->update_attempter_ = &update_attempter; |
192 update_attempter.set_dbus_service(service); | 195 update_attempter.set_dbus_service(service); |
193 chromeos_update_engine::SetupDbusService(service); | 196 chromeos_update_engine::SetupDbusService(service); |
194 | 197 |
(...skipping 10 matching lines...) Expand all Loading... |
205 g_main_loop_run(loop); | 208 g_main_loop_run(loop); |
206 | 209 |
207 // Cleanup: | 210 // Cleanup: |
208 g_main_loop_unref(loop); | 211 g_main_loop_unref(loop); |
209 update_attempter.set_dbus_service(NULL); | 212 update_attempter.set_dbus_service(NULL); |
210 g_object_unref(G_OBJECT(service)); | 213 g_object_unref(G_OBJECT(service)); |
211 | 214 |
212 LOG(INFO) << "Chrome OS Update Engine terminating"; | 215 LOG(INFO) << "Chrome OS Update Engine terminating"; |
213 return 0; | 216 return 0; |
214 } | 217 } |
OLD | NEW |