| 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/update_engine.h" | 5 #include "components/update_client/update_engine.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 DCHECK(!queue.empty()); | 278 DCHECK(!queue.empty()); |
| 279 | 279 |
| 280 const auto& id = queue.front(); | 280 const auto& id = queue.front(); |
| 281 DCHECK_EQ(1u, update_context->components.count(id)); | 281 DCHECK_EQ(1u, update_context->components.count(id)); |
| 282 const auto& component = update_context->components.at(id); | 282 const auto& component = update_context->components.at(id); |
| 283 DCHECK(component); | 283 DCHECK(component); |
| 284 | 284 |
| 285 if (component->IsHandled()) { | 285 if (component->IsHandled()) { |
| 286 (*it)->next_update_delay = component->GetUpdateDuration(); | 286 (*it)->next_update_delay = component->GetUpdateDuration(); |
| 287 | 287 |
| 288 // Only ping when the server response included an update for this component. | 288 if (!component->events().empty()) { |
| 289 if (component->CanPing()) { | |
| 290 ping_manager_->SendPing(*component); | 289 ping_manager_->SendPing(*component); |
| 291 } | 290 } |
| 292 | 291 |
| 293 queue.pop(); | 292 queue.pop(); |
| 294 } | 293 } |
| 295 | 294 |
| 296 base::ThreadTaskRunnerHandle::Get()->PostTask( | 295 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 297 FROM_HERE, | 296 FROM_HERE, |
| 298 base::Bind(&UpdateEngine::HandleComponent, base::Unretained(this), it)); | 297 base::Bind(&UpdateEngine::HandleComponent, base::Unretained(this), it)); |
| 299 } | 298 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 component->Uninstall(version, reason); | 360 component->Uninstall(version, reason); |
| 362 | 361 |
| 363 update_context->component_queue.push(id); | 362 update_context->component_queue.push(id); |
| 364 | 363 |
| 365 base::ThreadTaskRunnerHandle::Get()->PostTask( | 364 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 366 FROM_HERE, | 365 FROM_HERE, |
| 367 base::Bind(&UpdateEngine::HandleComponent, base::Unretained(this), it)); | 366 base::Bind(&UpdateEngine::HandleComponent, base::Unretained(this), it)); |
| 368 } | 367 } |
| 369 | 368 |
| 370 } // namespace update_client | 369 } // namespace update_client |
| OLD | NEW |