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

Side by Side Diff: main.cc

Issue 2868061: Measure and send update time to UMA. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 5 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) 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
8 #include <gflags/gflags.h> 9 #include <gflags/gflags.h>
9 #include <glib.h> 10 #include <glib.h>
11
10 #include "base/command_line.h" 12 #include "base/command_line.h"
11 #include "chromeos/obsolete_logging.h" 13 #include "chromeos/obsolete_logging.h"
14 #include "metrics/metrics_library.h"
12 #include "update_engine/dbus_constants.h" 15 #include "update_engine/dbus_constants.h"
13 #include "update_engine/dbus_service.h" 16 #include "update_engine/dbus_service.h"
14 #include "update_engine/update_attempter.h" 17 #include "update_engine/update_attempter.h"
15 18
16 extern "C" { 19 extern "C" {
17 #include "update_engine/update_engine.dbusserver.h" 20 #include "update_engine/update_engine.dbusserver.h"
18 } 21 }
19 22
20 DEFINE_bool(logtostderr, false, 23 DEFINE_bool(logtostderr, false,
21 "Write logs to stderr instead of to a file in log_dir."); 24 "Write logs to stderr instead of to a file in log_dir.");
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 logging::DONT_LOCK_LOG_FILE, 98 logging::DONT_LOCK_LOG_FILE,
96 logging::APPEND_TO_OLD_LOG_FILE); 99 logging::APPEND_TO_OLD_LOG_FILE);
97 if (!FLAGS_foreground) 100 if (!FLAGS_foreground)
98 PLOG_IF(FATAL, daemon(0, 0) == 1) << "daemon() failed"; 101 PLOG_IF(FATAL, daemon(0, 0) == 1) << "daemon() failed";
99 102
100 LOG(INFO) << "Chrome OS Update Engine starting"; 103 LOG(INFO) << "Chrome OS Update Engine starting";
101 104
102 // Create the single GMainLoop 105 // Create the single GMainLoop
103 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE); 106 GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE);
104 107
108 MetricsLibrary metrics_lib;
109 metrics_lib.Init();
110
105 // Create the update attempter: 111 // Create the update attempter:
106 chromeos_update_engine::UpdateAttempter update_attempter; 112 chromeos_update_engine::UpdateAttempter update_attempter(&metrics_lib);
107 113
108 // Create the dbus service object: 114 // Create the dbus service object:
109 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE, 115 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE,
110 &dbus_glib_update_engine_service_object_info); 116 &dbus_glib_update_engine_service_object_info);
111 UpdateEngineService* service = 117 UpdateEngineService* service =
112 UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); 118 UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL));
113 service->update_attempter_ = &update_attempter; 119 service->update_attempter_ = &update_attempter;
114 update_attempter.set_dbus_service(service); 120 update_attempter.set_dbus_service(service);
115 chromeos_update_engine::SetupDbusService(service); 121 chromeos_update_engine::SetupDbusService(service);
116 122
(...skipping 15 matching lines...) Expand all
132 g_main_loop_run(loop); 138 g_main_loop_run(loop);
133 139
134 // Cleanup: 140 // Cleanup:
135 g_main_loop_unref(loop); 141 g_main_loop_unref(loop);
136 update_attempter.set_dbus_service(NULL); 142 update_attempter.set_dbus_service(NULL);
137 g_object_unref(G_OBJECT(service)); 143 g_object_unref(G_OBJECT(service));
138 144
139 LOG(INFO) << "Chrome OS Update Engine terminating"; 145 LOG(INFO) << "Chrome OS Update Engine terminating";
140 return 0; 146 return 0;
141 } 147 }
OLDNEW
« no previous file with comments | « SConstruct ('k') | update_attempter.h » ('j') | update_attempter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698