| 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 #include <tr1/memory> | 6 #include <tr1/memory> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include <glib.h> | 9 #include <glib.h> |
| 10 #include "update_engine/download_action.h" | 10 #include "update_engine/download_action.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 processor_.set_delegate(this); | 28 processor_.set_delegate(this); |
| 29 | 29 |
| 30 // Actions: | 30 // Actions: |
| 31 shared_ptr<OmahaRequestPrepAction> request_prep_action( | 31 shared_ptr<OmahaRequestPrepAction> request_prep_action( |
| 32 new OmahaRequestPrepAction(force_full_update)); | 32 new OmahaRequestPrepAction(force_full_update)); |
| 33 shared_ptr<UpdateCheckAction> update_check_action( | 33 shared_ptr<UpdateCheckAction> update_check_action( |
| 34 new UpdateCheckAction(new LibcurlHttpFetcher)); | 34 new UpdateCheckAction(new LibcurlHttpFetcher)); |
| 35 shared_ptr<OmahaResponseHandlerAction> response_handler_action( | 35 shared_ptr<OmahaResponseHandlerAction> response_handler_action( |
| 36 new OmahaResponseHandlerAction); | 36 new OmahaResponseHandlerAction); |
| 37 shared_ptr<FilesystemCopierAction> filesystem_copier_action( | 37 shared_ptr<FilesystemCopierAction> filesystem_copier_action( |
| 38 new FilesystemCopierAction); | 38 new FilesystemCopierAction(false)); |
| 39 shared_ptr<FilesystemCopierAction> filesystem_copier_action_kernel( |
| 40 new FilesystemCopierAction(true)); |
| 39 shared_ptr<DownloadAction> download_action( | 41 shared_ptr<DownloadAction> download_action( |
| 40 new DownloadAction(new LibcurlHttpFetcher)); | 42 new DownloadAction(new LibcurlHttpFetcher)); |
| 41 shared_ptr<PostinstallRunnerAction> postinstall_runner_action( | 43 shared_ptr<PostinstallRunnerAction> postinstall_runner_action( |
| 42 new PostinstallRunnerAction); | 44 new PostinstallRunnerAction); |
| 43 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( | 45 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( |
| 44 new SetBootableFlagAction); | 46 new SetBootableFlagAction); |
| 45 | 47 |
| 46 response_handler_action_ = response_handler_action; | 48 response_handler_action_ = response_handler_action; |
| 47 | 49 |
| 48 actions_.push_back(shared_ptr<AbstractAction>(request_prep_action)); | 50 actions_.push_back(shared_ptr<AbstractAction>(request_prep_action)); |
| 49 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); | 51 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); |
| 50 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); | 52 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); |
| 51 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); | 53 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); |
| 54 actions_.push_back(shared_ptr<AbstractAction>( |
| 55 filesystem_copier_action_kernel)); |
| 52 actions_.push_back(shared_ptr<AbstractAction>(download_action)); | 56 actions_.push_back(shared_ptr<AbstractAction>(download_action)); |
| 53 actions_.push_back(shared_ptr<AbstractAction>(postinstall_runner_action)); | 57 actions_.push_back(shared_ptr<AbstractAction>(postinstall_runner_action)); |
| 54 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); | 58 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); |
| 55 | 59 |
| 56 // Enqueue the actions | 60 // Enqueue the actions |
| 57 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); | 61 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); |
| 58 it != actions_.end(); ++it) { | 62 it != actions_.end(); ++it) { |
| 59 processor_.EnqueueAction(it->get()); | 63 processor_.EnqueueAction(it->get()); |
| 60 } | 64 } |
| 61 | 65 |
| 62 // Bond them together. We have to use the leaf-types when calling | 66 // Bond them together. We have to use the leaf-types when calling |
| 63 // BondActions(). | 67 // BondActions(). |
| 64 BondActions(request_prep_action.get(), update_check_action.get()); | 68 BondActions(request_prep_action.get(), update_check_action.get()); |
| 65 BondActions(update_check_action.get(), response_handler_action.get()); | 69 BondActions(update_check_action.get(), response_handler_action.get()); |
| 66 BondActions(response_handler_action.get(), filesystem_copier_action.get()); | 70 BondActions(response_handler_action.get(), filesystem_copier_action.get()); |
| 67 BondActions(filesystem_copier_action.get(), download_action.get()); | 71 BondActions(response_handler_action.get(), |
| 72 filesystem_copier_action_kernel.get()); |
| 73 BondActions(filesystem_copier_action_kernel.get(), |
| 74 download_action.get()); |
| 68 // TODO(adlr): Bond these actions together properly | 75 // TODO(adlr): Bond these actions together properly |
| 69 // BondActions(download_action.get(), install_action.get()); | 76 // BondActions(download_action.get(), install_action.get()); |
| 70 // BondActions(install_action.get(), postinstall_runner_action.get()); | 77 // BondActions(install_action.get(), postinstall_runner_action.get()); |
| 71 BondActions(postinstall_runner_action.get(), set_bootable_flag_action.get()); | 78 BondActions(postinstall_runner_action.get(), set_bootable_flag_action.get()); |
| 72 | 79 |
| 73 processor_.StartProcessing(); | 80 processor_.StartProcessing(); |
| 74 } | 81 } |
| 75 | 82 |
| 76 // Delegate method: | 83 // Delegate method: |
| 77 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, | 84 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 *last_checked_time = 123; | 125 *last_checked_time = 123; |
| 119 *progress = 0.2223; | 126 *progress = 0.2223; |
| 120 *current_operation = "DOWNLOADING"; | 127 *current_operation = "DOWNLOADING"; |
| 121 *new_version = "0.2.3.8"; | 128 *new_version = "0.2.3.8"; |
| 122 *new_size = 10002; | 129 *new_size = 10002; |
| 123 return true; | 130 return true; |
| 124 } | 131 } |
| 125 | 132 |
| 126 | 133 |
| 127 } // namespace chromeos_update_engine | 134 } // namespace chromeos_update_engine |
| OLD | NEW |