Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / proximity_auth / cryptauth / sync_scheduler.cc
blob4e3dd320a17e774a0872148db3aa17c5aef28dda
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
3 // found in the LICENSE file.
5 #include "components/proximity_auth/cryptauth/sync_scheduler.h"
7 #include "components/proximity_auth/logging/logging.h"
9 namespace proximity_auth {
11 SyncScheduler::SyncRequest::SyncRequest(
12 base::WeakPtr<SyncScheduler> sync_scheduler)
13 : sync_scheduler_(sync_scheduler), completed_(false) {
16 SyncScheduler::SyncRequest::~SyncRequest() {
17 if (!completed_)
18 PA_LOG(ERROR) << "SyncRequest destroyed but Complete() was never called";
21 void SyncScheduler::SyncRequest::OnDidComplete(bool success) {
22 if (sync_scheduler_) {
23 sync_scheduler_->OnSyncCompleted(success);
24 sync_scheduler_.reset();
25 completed_ = true;
26 } else {
27 PA_LOG(ERROR) << "SyncRequest completed, but SyncScheduler destroyed.";
31 } // proximity_auth