OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // TODO(adlr): get rid of commented out lines or comment them back in. |
| 6 // Look for "// re-add" next to those comments. |
| 7 |
5 #include <string> | 8 #include <string> |
6 #include <tr1/memory> | 9 #include <tr1/memory> |
7 #include <vector> | 10 #include <vector> |
8 #include <gflags/gflags.h> | 11 #include <gflags/gflags.h> |
9 #include <glib.h> | 12 #include <glib.h> |
10 #include "chromeos/obsolete_logging.h" | 13 #include "chromeos/obsolete_logging.h" |
11 #include "update_engine/action_processor.h" | 14 #include "update_engine/action_processor.h" |
12 #include "update_engine/download_action.h" | 15 #include "update_engine/download_action.h" |
13 #include "update_engine/filesystem_copier_action.h" | 16 #include "update_engine/filesystem_copier_action.h" |
14 #include "update_engine/install_action.h" | 17 // #include "update_engine/install_action.h" // re-add |
15 #include "update_engine/libcurl_http_fetcher.h" | 18 #include "update_engine/libcurl_http_fetcher.h" |
16 #include "update_engine/omaha_request_prep_action.h" | 19 #include "update_engine/omaha_request_prep_action.h" |
17 #include "update_engine/omaha_response_handler_action.h" | 20 #include "update_engine/omaha_response_handler_action.h" |
18 #include "update_engine/postinstall_runner_action.h" | 21 #include "update_engine/postinstall_runner_action.h" |
19 #include "update_engine/set_bootable_flag_action.h" | 22 #include "update_engine/set_bootable_flag_action.h" |
20 #include "update_engine/update_check_action.h" | 23 #include "update_engine/update_check_action.h" |
21 | 24 |
22 using std::string; | 25 using std::string; |
23 using std::tr1::shared_ptr; | 26 using std::tr1::shared_ptr; |
24 using std::vector; | 27 using std::vector; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 shared_ptr<OmahaRequestPrepAction> request_prep_action( | 60 shared_ptr<OmahaRequestPrepAction> request_prep_action( |
58 new OmahaRequestPrepAction(force_full_update)); | 61 new OmahaRequestPrepAction(force_full_update)); |
59 shared_ptr<UpdateCheckAction> update_check_action( | 62 shared_ptr<UpdateCheckAction> update_check_action( |
60 new UpdateCheckAction(new LibcurlHttpFetcher)); | 63 new UpdateCheckAction(new LibcurlHttpFetcher)); |
61 shared_ptr<OmahaResponseHandlerAction> response_handler_action( | 64 shared_ptr<OmahaResponseHandlerAction> response_handler_action( |
62 new OmahaResponseHandlerAction); | 65 new OmahaResponseHandlerAction); |
63 shared_ptr<FilesystemCopierAction> filesystem_copier_action( | 66 shared_ptr<FilesystemCopierAction> filesystem_copier_action( |
64 new FilesystemCopierAction); | 67 new FilesystemCopierAction); |
65 shared_ptr<DownloadAction> download_action( | 68 shared_ptr<DownloadAction> download_action( |
66 new DownloadAction(new LibcurlHttpFetcher)); | 69 new DownloadAction(new LibcurlHttpFetcher)); |
67 shared_ptr<InstallAction> install_action( | 70 // shared_ptr<InstallAction> install_action( // re-add |
68 new InstallAction); | 71 // new InstallAction); |
69 shared_ptr<PostinstallRunnerAction> postinstall_runner_action( | 72 shared_ptr<PostinstallRunnerAction> postinstall_runner_action( |
70 new PostinstallRunnerAction); | 73 new PostinstallRunnerAction); |
71 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( | 74 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( |
72 new SetBootableFlagAction); | 75 new SetBootableFlagAction); |
73 | 76 |
74 response_handler_action_ = response_handler_action; | 77 response_handler_action_ = response_handler_action; |
75 | 78 |
76 actions_.push_back(shared_ptr<AbstractAction>(request_prep_action)); | 79 actions_.push_back(shared_ptr<AbstractAction>(request_prep_action)); |
77 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); | 80 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); |
78 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); | 81 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); |
79 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); | 82 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); |
80 actions_.push_back(shared_ptr<AbstractAction>(download_action)); | 83 actions_.push_back(shared_ptr<AbstractAction>(download_action)); |
81 actions_.push_back(shared_ptr<AbstractAction>(install_action)); | 84 // actions_.push_back(shared_ptr<AbstractAction>(install_action)); // re-add |
82 actions_.push_back(shared_ptr<AbstractAction>(postinstall_runner_action)); | 85 actions_.push_back(shared_ptr<AbstractAction>(postinstall_runner_action)); |
83 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); | 86 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); |
84 | 87 |
85 // Enqueue the actions | 88 // Enqueue the actions |
86 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); | 89 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); |
87 it != actions_.end(); ++it) { | 90 it != actions_.end(); ++it) { |
88 processor_.EnqueueAction(it->get()); | 91 processor_.EnqueueAction(it->get()); |
89 } | 92 } |
90 | 93 |
91 // Bond them together. We have to use the leaf-types when calling | 94 // Bond them together. We have to use the leaf-types when calling |
92 // BondActions(). | 95 // BondActions(). |
93 BondActions(request_prep_action.get(), update_check_action.get()); | 96 BondActions(request_prep_action.get(), update_check_action.get()); |
94 BondActions(update_check_action.get(), response_handler_action.get()); | 97 BondActions(update_check_action.get(), response_handler_action.get()); |
95 BondActions(response_handler_action.get(), filesystem_copier_action.get()); | 98 BondActions(response_handler_action.get(), filesystem_copier_action.get()); |
96 BondActions(filesystem_copier_action.get(), download_action.get()); | 99 BondActions(filesystem_copier_action.get(), download_action.get()); |
97 BondActions(download_action.get(), install_action.get()); | 100 // BondActions(download_action.get(), install_action.get()); // re-add |
98 BondActions(install_action.get(), postinstall_runner_action.get()); | 101 // BondActions(install_action.get(), postinstall_runner_action.get()); |
99 BondActions(postinstall_runner_action.get(), set_bootable_flag_action.get()); | 102 BondActions(postinstall_runner_action.get(), set_bootable_flag_action.get()); |
100 | 103 |
101 processor_.StartProcessing(); | 104 processor_.StartProcessing(); |
102 } | 105 } |
103 | 106 |
104 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, | 107 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, |
105 bool success) { | 108 bool success) { |
106 CHECK(response_handler_action_); | 109 CHECK(response_handler_action_); |
107 if (response_handler_action_->GotNoUpdateResponse()) { | 110 if (response_handler_action_->GotNoUpdateResponse()) { |
108 // All done. | 111 // All done. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 154 |
152 g_timeout_add(0, &chromeos_update_engine::UpdateInMainLoop, | 155 g_timeout_add(0, &chromeos_update_engine::UpdateInMainLoop, |
153 &update_attempter); | 156 &update_attempter); |
154 | 157 |
155 g_main_loop_run(loop); | 158 g_main_loop_run(loop); |
156 g_main_loop_unref(loop); | 159 g_main_loop_unref(loop); |
157 | 160 |
158 LOG(INFO) << "Chrome OS Update Engine terminating"; | 161 LOG(INFO) << "Chrome OS Update Engine terminating"; |
159 return 0; | 162 return 0; |
160 } | 163 } |
OLD | NEW |