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 <tr1/memory> | 6 #include <tr1/memory> |
7 #include <vector> | 7 #include <vector> |
8 #include <gflags/gflags.h> | 8 #include <gflags/gflags.h> |
9 #include <glib.h> | 9 #include <glib.h> |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 struct PeriodicallyUpdateArgs { | 33 struct PeriodicallyUpdateArgs { |
34 UpdateAttempter* update_attempter; | 34 UpdateAttempter* update_attempter; |
35 gboolean should_repeat; | 35 gboolean should_repeat; |
36 }; | 36 }; |
37 | 37 |
38 gboolean PeriodicallyUpdate(void* arg) { | 38 gboolean PeriodicallyUpdate(void* arg) { |
39 PeriodicallyUpdateArgs* args = reinterpret_cast<PeriodicallyUpdateArgs*>(arg); | 39 PeriodicallyUpdateArgs* args = reinterpret_cast<PeriodicallyUpdateArgs*>(arg); |
40 args->update_attempter->Update(false); | 40 args->update_attempter->Update(); |
41 return args->should_repeat; | 41 return args->should_repeat; |
42 } | 42 } |
43 | 43 |
44 void SetupDbusService(UpdateEngineService* service) { | 44 void SetupDbusService(UpdateEngineService* service) { |
45 DBusGConnection *bus; | 45 DBusGConnection *bus; |
46 DBusGProxy *proxy; | 46 DBusGProxy *proxy; |
47 GError *error = NULL; | 47 GError *error = NULL; |
48 | 48 |
49 bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); | 49 bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); |
50 if (!bus) { | 50 if (!bus) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 logging::InitLogging("/var/log/update_engine.log", | 91 logging::InitLogging("/var/log/update_engine.log", |
92 (FLAGS_logtostderr ? | 92 (FLAGS_logtostderr ? |
93 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG : | 93 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG : |
94 logging::LOG_ONLY_TO_FILE), | 94 logging::LOG_ONLY_TO_FILE), |
95 logging::DONT_LOCK_LOG_FILE, | 95 logging::DONT_LOCK_LOG_FILE, |
96 logging::APPEND_TO_OLD_LOG_FILE); | 96 logging::APPEND_TO_OLD_LOG_FILE); |
97 if (!FLAGS_foreground) | 97 if (!FLAGS_foreground) |
98 PLOG_IF(FATAL, daemon(0, 0) == 1) << "daemon() failed"; | 98 PLOG_IF(FATAL, daemon(0, 0) == 1) << "daemon() failed"; |
99 | 99 |
100 LOG(INFO) << "Chrome OS Update Engine starting"; | 100 LOG(INFO) << "Chrome OS Update Engine starting"; |
101 | 101 |
102 // Create the single GMainLoop | 102 // Create the single GMainLoop |
103 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); | 103 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); |
104 | 104 |
105 // Create the update attempter: | 105 // Create the update attempter: |
106 chromeos_update_engine::UpdateAttempter update_attempter; | 106 chromeos_update_engine::UpdateAttempter update_attempter; |
107 | 107 |
108 // Create the dbus service object: | 108 // Create the dbus service object: |
109 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE, | 109 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE, |
110 &dbus_glib_update_engine_service_object_info); | 110 &dbus_glib_update_engine_service_object_info); |
111 UpdateEngineService* service = | 111 UpdateEngineService* service = |
(...skipping 20 matching lines...) Expand all Loading... |
132 g_main_loop_run(loop); | 132 g_main_loop_run(loop); |
133 | 133 |
134 // Cleanup: | 134 // Cleanup: |
135 g_main_loop_unref(loop); | 135 g_main_loop_unref(loop); |
136 update_attempter.set_dbus_service(NULL); | 136 update_attempter.set_dbus_service(NULL); |
137 g_object_unref(G_OBJECT(service)); | 137 g_object_unref(G_OBJECT(service)); |
138 | 138 |
139 LOG(INFO) << "Chrome OS Update Engine terminating"; | 139 LOG(INFO) << "Chrome OS Update Engine terminating"; |
140 return 0; | 140 return 0; |
141 } | 141 } |
OLD | NEW |