Chromium Code Reviews| Index: components/proximity_auth/cryptauth/sync_scheduler.cc |
| diff --git a/components/proximity_auth/cryptauth/sync_scheduler.cc b/components/proximity_auth/cryptauth/sync_scheduler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0fbe495b91923bb4e0cdc52ecc4bd70997bdbbcd |
| --- /dev/null |
| +++ b/components/proximity_auth/cryptauth/sync_scheduler.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/proximity_auth/cryptauth/sync_scheduler.h" |
| + |
| +#include "components/proximity_auth/logging/logging.h" |
| + |
| +namespace proximity_auth { |
| + |
| +SyncScheduler::SyncRequest::SyncRequest( |
| + base::WeakPtr<SyncScheduler> sync_scheduler, |
| + bool is_aggressive_recovery) |
| + : sync_scheduler_(sync_scheduler), |
| + is_aggressive_recovery_(is_aggressive_recovery), |
|
Ilya Sherman
2015/05/18 23:25:38
What is this variable used for?
Tim Song
2015/05/19 22:13:18
I was going to use it to set the InvocationReason
|
| + completed_(false) { |
| +} |
| + |
| +SyncScheduler::SyncRequest::~SyncRequest() { |
| + if (!completed_) |
| + PA_LOG(ERROR) << "SyncRequest destroyed but Complete() was never called"; |
| +} |
| + |
| +void SyncScheduler::SyncRequest::Complete(bool success) { |
| + if (sync_scheduler_) { |
| + sync_scheduler_->OnSyncCompleted(success); |
| + sync_scheduler_.reset(); |
| + completed_ = true; |
| + } else { |
| + PA_LOG(ERROR) << "SyncRequest completed, but SyncScheduler destroyed."; |
| + } |
| +} |
| + |
| +} // proximity_auth |