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

Side by Side Diff: src/platform/update_engine/update_attempter.cc

Issue 1881001: AU: Many minor cleanup changes (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fixes for review Created 10 years, 7 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
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 "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 18 matching lines...) Expand all
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(false)); 38 new FilesystemCopierAction(false));
39 shared_ptr<FilesystemCopierAction> filesystem_copier_action_kernel( 39 shared_ptr<FilesystemCopierAction> kernel_filesystem_copier_action(
40 new FilesystemCopierAction(true)); 40 new FilesystemCopierAction(true));
41 shared_ptr<DownloadAction> download_action( 41 shared_ptr<DownloadAction> download_action(
42 new DownloadAction(new LibcurlHttpFetcher)); 42 new DownloadAction(new LibcurlHttpFetcher));
43 shared_ptr<PostinstallRunnerAction> postinstall_runner_action( 43 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_precommit(
44 new PostinstallRunnerAction); 44 new PostinstallRunnerAction(true));
45 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( 45 shared_ptr<SetBootableFlagAction> set_bootable_flag_action(
46 new SetBootableFlagAction); 46 new SetBootableFlagAction);
47 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_postcommit(
48 new PostinstallRunnerAction(false));
47 49
48 response_handler_action_ = response_handler_action; 50 response_handler_action_ = response_handler_action;
49 51
50 actions_.push_back(shared_ptr<AbstractAction>(request_prep_action)); 52 actions_.push_back(shared_ptr<AbstractAction>(request_prep_action));
51 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); 53 actions_.push_back(shared_ptr<AbstractAction>(update_check_action));
52 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); 54 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action));
53 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); 55 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action));
54 actions_.push_back(shared_ptr<AbstractAction>( 56 actions_.push_back(shared_ptr<AbstractAction>(
55 filesystem_copier_action_kernel)); 57 kernel_filesystem_copier_action));
56 actions_.push_back(shared_ptr<AbstractAction>(download_action)); 58 actions_.push_back(shared_ptr<AbstractAction>(download_action));
57 actions_.push_back(shared_ptr<AbstractAction>(postinstall_runner_action)); 59 actions_.push_back(shared_ptr<AbstractAction>(
60 postinstall_runner_action_precommit));
58 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); 61 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action));
62 actions_.push_back(shared_ptr<AbstractAction>(
63 postinstall_runner_action_postcommit));
59 64
60 // Enqueue the actions 65 // Enqueue the actions
61 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); 66 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin();
62 it != actions_.end(); ++it) { 67 it != actions_.end(); ++it) {
63 processor_.EnqueueAction(it->get()); 68 processor_.EnqueueAction(it->get());
64 } 69 }
65 70
66 // Bond them together. We have to use the leaf-types when calling 71 // Bond them together. We have to use the leaf-types when calling
67 // BondActions(). 72 // BondActions().
68 BondActions(request_prep_action.get(), update_check_action.get()); 73 BondActions(request_prep_action.get(), update_check_action.get());
69 BondActions(update_check_action.get(), response_handler_action.get()); 74 BondActions(update_check_action.get(), response_handler_action.get());
70 BondActions(response_handler_action.get(), filesystem_copier_action.get()); 75 BondActions(response_handler_action.get(), filesystem_copier_action.get());
71 BondActions(response_handler_action.get(), 76 BondActions(response_handler_action.get(),
72 filesystem_copier_action_kernel.get()); 77 kernel_filesystem_copier_action.get());
73 BondActions(filesystem_copier_action_kernel.get(), 78 BondActions(kernel_filesystem_copier_action.get(),
74 download_action.get()); 79 download_action.get());
75 // TODO(adlr): Bond these actions together properly 80 BondActions(download_action.get(), postinstall_runner_action_precommit.get());
76 // BondActions(download_action.get(), install_action.get()); 81 BondActions(postinstall_runner_action_precommit.get(),
77 // BondActions(install_action.get(), postinstall_runner_action.get()); 82 set_bootable_flag_action.get());
78 BondActions(postinstall_runner_action.get(), set_bootable_flag_action.get()); 83 BondActions(set_bootable_flag_action.get(),
84 postinstall_runner_action_postcommit.get());
79 85
80 processor_.StartProcessing(); 86 processor_.StartProcessing();
81 } 87 }
82 88
83 // Delegate method: 89 // Delegate method:
84 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor, 90 void UpdateAttempter::ProcessingDone(const ActionProcessor* processor,
85 bool success) { 91 bool success) {
86 CHECK(response_handler_action_); 92 CHECK(response_handler_action_);
87 if (response_handler_action_->GotNoUpdateResponse()) { 93 if (response_handler_action_->GotNoUpdateResponse()) {
88 // All done. 94 // All done.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 *last_checked_time = 123; 131 *last_checked_time = 123;
126 *progress = 0.2223; 132 *progress = 0.2223;
127 *current_operation = "DOWNLOADING"; 133 *current_operation = "DOWNLOADING";
128 *new_version = "0.2.3.8"; 134 *new_version = "0.2.3.8";
129 *new_size = 10002; 135 *new_size = 10002;
130 return true; 136 return true;
131 } 137 }
132 138
133 139
134 } // namespace chromeos_update_engine 140 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « src/platform/update_engine/set_bootable_flag_action_unittest.cc ('k') | src/platform/update_engine/update_check_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698