1 // Copyright 2013 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. 4 5 #include "sync/notifier/dropped_invalidation_tracker.h" 6 7 #include "sync/internal_api/public/base/invalidation.h" 8 9 namespace syncer { 10 DroppedInvalidationTracker(const invalidation::ObjectId & id)11DroppedInvalidationTracker::DroppedInvalidationTracker( 12 const invalidation::ObjectId& id) 13 : id_(id), 14 drop_ack_handle_(AckHandle::InvalidAckHandle()), 15 recovering_from_drop_(false) {} 16 ~DroppedInvalidationTracker()17DroppedInvalidationTracker::~DroppedInvalidationTracker() {} 18 object_id() const19const invalidation::ObjectId& DroppedInvalidationTracker::object_id() const { 20 return id_; 21 } 22 RecordDropEvent(WeakHandle<AckHandler> handler,AckHandle handle)23void DroppedInvalidationTracker::RecordDropEvent( 24 WeakHandle<AckHandler> handler, AckHandle handle) { 25 drop_ack_handler_ = handler; 26 drop_ack_handle_ = handle; 27 recovering_from_drop_ = true; 28 } 29 RecordRecoveryFromDropEvent()30void DroppedInvalidationTracker::RecordRecoveryFromDropEvent() { 31 if (drop_ack_handler_.IsInitialized()) { 32 drop_ack_handler_.Call(FROM_HERE, 33 &AckHandler::Acknowledge, 34 id_, 35 drop_ack_handle_); 36 } 37 drop_ack_handler_ = syncer::WeakHandle<AckHandler>(); 38 recovering_from_drop_ = false; 39 } 40 IsRecoveringFromDropEvent() const41bool DroppedInvalidationTracker::IsRecoveringFromDropEvent() const { 42 return recovering_from_drop_; 43 } 44 45 } // namespace syncer 46