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 "update_engine/update_attempter.h" | 5 #include "update_engine/update_attempter.h" |
6 | 6 |
7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L | 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L |
8 #ifndef _POSIX_C_SOURCE | 8 #ifndef _POSIX_C_SOURCE |
9 #define _POSIX_C_SOURCE 199309L | 9 #define _POSIX_C_SOURCE 199309L |
10 #endif // _POSIX_C_SOURCE | 10 #endif // _POSIX_C_SOURCE |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 shared_ptr<OmahaRequestAction> update_check_action( | 106 shared_ptr<OmahaRequestAction> update_check_action( |
107 new OmahaRequestAction(omaha_request_params_, | 107 new OmahaRequestAction(omaha_request_params_, |
108 NULL, | 108 NULL, |
109 new LibcurlHttpFetcher)); | 109 new LibcurlHttpFetcher)); |
110 shared_ptr<OmahaResponseHandlerAction> response_handler_action( | 110 shared_ptr<OmahaResponseHandlerAction> response_handler_action( |
111 new OmahaResponseHandlerAction); | 111 new OmahaResponseHandlerAction); |
112 shared_ptr<FilesystemCopierAction> filesystem_copier_action( | 112 shared_ptr<FilesystemCopierAction> filesystem_copier_action( |
113 new FilesystemCopierAction(false)); | 113 new FilesystemCopierAction(false)); |
114 shared_ptr<FilesystemCopierAction> kernel_filesystem_copier_action( | 114 shared_ptr<FilesystemCopierAction> kernel_filesystem_copier_action( |
115 new FilesystemCopierAction(true)); | 115 new FilesystemCopierAction(true)); |
| 116 shared_ptr<OmahaRequestAction> download_started_action( |
| 117 new OmahaRequestAction(omaha_request_params_, |
| 118 new OmahaEvent( |
| 119 OmahaEvent::kTypeUpdateDownloadStarted, |
| 120 OmahaEvent::kResultSuccess, |
| 121 0), |
| 122 new LibcurlHttpFetcher)); |
116 shared_ptr<DownloadAction> download_action( | 123 shared_ptr<DownloadAction> download_action( |
117 new DownloadAction(new LibcurlHttpFetcher)); | 124 new DownloadAction(new LibcurlHttpFetcher)); |
| 125 shared_ptr<OmahaRequestAction> download_finished_action( |
| 126 new OmahaRequestAction(omaha_request_params_, |
| 127 new OmahaEvent( |
| 128 OmahaEvent::kTypeUpdateDownloadFinished, |
| 129 OmahaEvent::kResultSuccess, |
| 130 0), |
| 131 new LibcurlHttpFetcher)); |
118 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_precommit( | 132 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_precommit( |
119 new PostinstallRunnerAction(true)); | 133 new PostinstallRunnerAction(true)); |
120 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( | 134 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( |
121 new SetBootableFlagAction); | 135 new SetBootableFlagAction); |
122 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_postcommit( | 136 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_postcommit( |
123 new PostinstallRunnerAction(false)); | 137 new PostinstallRunnerAction(false)); |
124 shared_ptr<OmahaRequestAction> install_success_action( | 138 shared_ptr<OmahaRequestAction> update_complete_action( |
125 new OmahaRequestAction(omaha_request_params_, | 139 new OmahaRequestAction(omaha_request_params_, |
126 new OmahaEvent(OmahaEvent::kTypeInstallComplete, | 140 new OmahaEvent(OmahaEvent::kTypeUpdateComplete, |
127 OmahaEvent::kResultSuccess, | 141 OmahaEvent::kResultSuccess, |
128 0), | 142 0), |
129 new LibcurlHttpFetcher)); | 143 new LibcurlHttpFetcher)); |
130 | 144 |
131 download_action->set_delegate(this); | 145 download_action->set_delegate(this); |
132 response_handler_action_ = response_handler_action; | 146 response_handler_action_ = response_handler_action; |
133 | 147 |
134 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); | 148 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); |
135 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); | 149 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); |
136 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); | 150 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); |
137 actions_.push_back(shared_ptr<AbstractAction>( | 151 actions_.push_back(shared_ptr<AbstractAction>( |
138 kernel_filesystem_copier_action)); | 152 kernel_filesystem_copier_action)); |
| 153 actions_.push_back(shared_ptr<AbstractAction>(download_started_action)); |
139 actions_.push_back(shared_ptr<AbstractAction>(download_action)); | 154 actions_.push_back(shared_ptr<AbstractAction>(download_action)); |
| 155 actions_.push_back(shared_ptr<AbstractAction>(download_finished_action)); |
140 actions_.push_back(shared_ptr<AbstractAction>( | 156 actions_.push_back(shared_ptr<AbstractAction>( |
141 postinstall_runner_action_precommit)); | 157 postinstall_runner_action_precommit)); |
142 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); | 158 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); |
143 actions_.push_back(shared_ptr<AbstractAction>( | 159 actions_.push_back(shared_ptr<AbstractAction>( |
144 postinstall_runner_action_postcommit)); | 160 postinstall_runner_action_postcommit)); |
145 actions_.push_back(shared_ptr<AbstractAction>(install_success_action)); | 161 actions_.push_back(shared_ptr<AbstractAction>(update_complete_action)); |
146 | 162 |
147 // Enqueue the actions | 163 // Enqueue the actions |
148 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); | 164 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); |
149 it != actions_.end(); ++it) { | 165 it != actions_.end(); ++it) { |
150 processor_.EnqueueAction(it->get()); | 166 processor_.EnqueueAction(it->get()); |
151 } | 167 } |
152 | 168 |
153 // Bond them together. We have to use the leaf-types when calling | 169 // Bond them together. We have to use the leaf-types when calling |
154 // BondActions(). | 170 // BondActions(). |
155 BondActions(update_check_action.get(), | 171 BondActions(update_check_action.get(), |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 update_engine_service_emit_status_update( | 297 update_engine_service_emit_status_update( |
282 dbus_service_, | 298 dbus_service_, |
283 last_checked_time_, | 299 last_checked_time_, |
284 download_progress_, | 300 download_progress_, |
285 UpdateStatusToString(status_), | 301 UpdateStatusToString(status_), |
286 new_version_.c_str(), | 302 new_version_.c_str(), |
287 new_size_); | 303 new_size_); |
288 } | 304 } |
289 | 305 |
290 } // namespace chromeos_update_engine | 306 } // namespace chromeos_update_engine |
OLD | NEW |