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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 BondActions(kernel_filesystem_copier_action.get(), | 241 BondActions(kernel_filesystem_copier_action.get(), |
242 download_action.get()); | 242 download_action.get()); |
243 BondActions(download_action.get(), | 243 BondActions(download_action.get(), |
244 filesystem_verifier_action.get()); | 244 filesystem_verifier_action.get()); |
245 BondActions(filesystem_verifier_action.get(), | 245 BondActions(filesystem_verifier_action.get(), |
246 kernel_filesystem_verifier_action.get()); | 246 kernel_filesystem_verifier_action.get()); |
247 BondActions(kernel_filesystem_verifier_action.get(), | 247 BondActions(kernel_filesystem_verifier_action.get(), |
248 postinstall_runner_action.get()); | 248 postinstall_runner_action.get()); |
249 | 249 |
250 SetStatusAndNotify(UPDATE_STATUS_CHECKING_FOR_UPDATE); | 250 SetStatusAndNotify(UPDATE_STATUS_CHECKING_FOR_UPDATE); |
251 processor_->StartProcessing(); | 251 |
| 252 // Start the processing asynchronously to unblock the event loop. |
| 253 g_idle_add(&StaticStartProcessing, this); |
252 } | 254 } |
253 | 255 |
254 void UpdateAttempter::CheckForUpdate(const std::string& app_version, | 256 void UpdateAttempter::CheckForUpdate(const std::string& app_version, |
255 const std::string& omaha_url) { | 257 const std::string& omaha_url) { |
256 if (status_ != UPDATE_STATUS_IDLE) { | 258 if (status_ != UPDATE_STATUS_IDLE) { |
257 LOG(INFO) << "Check for update requested, but status is " | 259 LOG(INFO) << "Check for update requested, but status is " |
258 << UpdateStatusToString(status_) << ", so not checking."; | 260 << UpdateStatusToString(status_) << ", so not checking."; |
259 return; | 261 return; |
260 } | 262 } |
261 Update(app_version, omaha_url, true); | 263 Update(app_version, omaha_url, true); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 g_source_destroy(manage_priority_source_); | 522 g_source_destroy(manage_priority_source_); |
521 manage_priority_source_ = NULL; | 523 manage_priority_source_ = NULL; |
522 } | 524 } |
523 SetPriority(utils::kProcessPriorityNormal); | 525 SetPriority(utils::kProcessPriorityNormal); |
524 } | 526 } |
525 | 527 |
526 gboolean UpdateAttempter::StaticManagePriorityCallback(gpointer data) { | 528 gboolean UpdateAttempter::StaticManagePriorityCallback(gpointer data) { |
527 return reinterpret_cast<UpdateAttempter*>(data)->ManagePriorityCallback(); | 529 return reinterpret_cast<UpdateAttempter*>(data)->ManagePriorityCallback(); |
528 } | 530 } |
529 | 531 |
| 532 gboolean UpdateAttempter::StaticStartProcessing(gpointer data) { |
| 533 reinterpret_cast<UpdateAttempter*>(data)->processor_->StartProcessing(); |
| 534 return FALSE; // Don't call this callback again. |
| 535 } |
| 536 |
530 bool UpdateAttempter::ManagePriorityCallback() { | 537 bool UpdateAttempter::ManagePriorityCallback() { |
531 SetPriority(utils::kProcessPriorityNormal); | 538 SetPriority(utils::kProcessPriorityNormal); |
532 manage_priority_source_ = NULL; | 539 manage_priority_source_ = NULL; |
533 return false; // Destroy the timeout source. | 540 return false; // Destroy the timeout source. |
534 } | 541 } |
535 | 542 |
536 void UpdateAttempter::DisableDeltaUpdateIfNeeded() { | 543 void UpdateAttempter::DisableDeltaUpdateIfNeeded() { |
537 int64_t delta_failures; | 544 int64_t delta_failures; |
538 if (omaha_request_params_.delta_okay && | 545 if (omaha_request_params_.delta_okay && |
539 prefs_->GetInt64(kPrefsDeltaUpdateFailures, &delta_failures) && | 546 prefs_->GetInt64(kPrefsDeltaUpdateFailures, &delta_failures) && |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 uint64_t resume_offset = manifest_metadata_size + next_data_offset; | 579 uint64_t resume_offset = manifest_metadata_size + next_data_offset; |
573 if (resume_offset < response_handler_action_->install_plan().size) { | 580 if (resume_offset < response_handler_action_->install_plan().size) { |
574 fetcher->AddRange(resume_offset, -1); | 581 fetcher->AddRange(resume_offset, -1); |
575 } | 582 } |
576 } else { | 583 } else { |
577 fetcher->AddRange(0, -1); | 584 fetcher->AddRange(0, -1); |
578 } | 585 } |
579 } | 586 } |
580 | 587 |
581 } // namespace chromeos_update_engine | 588 } // namespace chromeos_update_engine |
OLD | NEW |