| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 "components/update_client/action.h" | 5 #include "components/update_client/action.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 std::unique_ptr<Action> update_action( | 139 std::unique_ptr<Action> update_action( |
| 140 CanTryDiffUpdate(item, update_context_->config) | 140 CanTryDiffUpdate(item, update_context_->config) |
| 141 ? ActionUpdateDiff::Create() | 141 ? ActionUpdateDiff::Create() |
| 142 : ActionUpdateFull::Create()); | 142 : ActionUpdateFull::Create()); |
| 143 | 143 |
| 144 base::ThreadTaskRunnerHandle::Get()->PostTask( | 144 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 145 FROM_HERE, base::Bind(&Action::Run, base::Unretained(update_action.get()), | 145 FROM_HERE, base::Bind(&Action::Run, base::Unretained(update_action.get()), |
| 146 update_context_, callback_)); | 146 update_context_, callback_)); |
| 147 | 147 |
| 148 update_context_->current_action.reset(update_action.release()); | 148 update_context_->current_action = std::move(update_action); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void ActionImpl::UpdateCrxComplete(CrxUpdateItem* item) { | 151 void ActionImpl::UpdateCrxComplete(CrxUpdateItem* item) { |
| 152 DCHECK(thread_checker_.CalledOnValidThread()); | 152 DCHECK(thread_checker_.CalledOnValidThread()); |
| 153 DCHECK(item); | 153 DCHECK(item); |
| 154 | 154 |
| 155 update_context_->ping_manager->SendPing(item); | 155 update_context_->ping_manager->SendPing(item); |
| 156 | 156 |
| 157 update_context_->queue.pop(); | 157 update_context_->queue.pop(); |
| 158 | 158 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 170 item->update_begin); | 170 item->update_begin); |
| 171 DCHECK(update_cost >= base::TimeDelta()); | 171 DCHECK(update_cost >= base::TimeDelta()); |
| 172 | 172 |
| 173 std::unique_ptr<ActionWait> action_wait( | 173 std::unique_ptr<ActionWait> action_wait( |
| 174 new ActionWait(std::min(update_cost, max_update_delay))); | 174 new ActionWait(std::min(update_cost, max_update_delay))); |
| 175 | 175 |
| 176 base::ThreadTaskRunnerHandle::Get()->PostTask( | 176 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 177 FROM_HERE, base::Bind(&Action::Run, base::Unretained(action_wait.get()), | 177 FROM_HERE, base::Bind(&Action::Run, base::Unretained(action_wait.get()), |
| 178 update_context_, callback_)); | 178 update_context_, callback_)); |
| 179 | 179 |
| 180 update_context_->current_action.reset(action_wait.release()); | 180 update_context_->current_action = std::move(action_wait); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 void ActionImpl::UpdateComplete(Error error) { | 184 void ActionImpl::UpdateComplete(Error error) { |
| 185 DCHECK(thread_checker_.CalledOnValidThread()); | 185 DCHECK(thread_checker_.CalledOnValidThread()); |
| 186 | 186 |
| 187 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 187 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 188 base::Bind(callback_, error)); | 188 base::Bind(callback_, error)); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace update_client | 191 } // namespace update_client |
| OLD | NEW |