| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "sync/internal_api/public/base/invalidation.h" | 5 #include "sync/internal_api/public/base/invalidation.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "sync/notifier/ack_handler.h" | 13 #include "sync/notifier/ack_handler.h" |
| 14 #include "sync/notifier/dropped_invalidation_tracker.h" | |
| 15 #include "sync/notifier/invalidation_util.h" | 14 #include "sync/notifier/invalidation_util.h" |
| 16 | 15 |
| 17 namespace syncer { | 16 namespace syncer { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 const char kObjectIdKey[] = "objectId"; | 19 const char kObjectIdKey[] = "objectId"; |
| 21 const char kIsUnknownVersionKey[] = "isUnknownVersion"; | 20 const char kIsUnknownVersionKey[] = "isUnknownVersion"; |
| 22 const char kVersionKey[] = "version"; | 21 const char kVersionKey[] = "version"; |
| 23 const char kPayloadKey[] = "payload"; | 22 const char kPayloadKey[] = "payload"; |
| 24 const int64 kInvalidVersion = -1; | 23 const int64 kInvalidVersion = -1; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 120 |
| 122 void Invalidation::Acknowledge() const { | 121 void Invalidation::Acknowledge() const { |
| 123 if (SupportsAcknowledgement()) { | 122 if (SupportsAcknowledgement()) { |
| 124 ack_handler_.Call(FROM_HERE, | 123 ack_handler_.Call(FROM_HERE, |
| 125 &AckHandler::Acknowledge, | 124 &AckHandler::Acknowledge, |
| 126 id_, | 125 id_, |
| 127 ack_handle_); | 126 ack_handle_); |
| 128 } | 127 } |
| 129 } | 128 } |
| 130 | 129 |
| 131 void Invalidation::Drop(DroppedInvalidationTracker* tracker) const { | 130 void Invalidation::Drop() { |
| 132 DCHECK(tracker->object_id() == object_id()); | |
| 133 tracker->RecordDropEvent(ack_handler_, ack_handle_); | |
| 134 if (SupportsAcknowledgement()) { | 131 if (SupportsAcknowledgement()) { |
| 135 ack_handler_.Call(FROM_HERE, | 132 ack_handler_.Call(FROM_HERE, |
| 136 &AckHandler::Drop, | 133 &AckHandler::Drop, |
| 137 id_, | 134 id_, |
| 138 ack_handle_); | 135 ack_handle_); |
| 139 } | 136 } |
| 140 } | 137 } |
| 141 | 138 |
| 142 bool Invalidation::Equals(const Invalidation& other) const { | 139 bool Invalidation::Equals(const Invalidation& other) const { |
| 143 return id_ == other.id_ | 140 return id_ == other.id_ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 173 int64 version, | 170 int64 version, |
| 174 const std::string& payload, | 171 const std::string& payload, |
| 175 AckHandle ack_handle) | 172 AckHandle ack_handle) |
| 176 : id_(id), | 173 : id_(id), |
| 177 is_unknown_version_(is_unknown_version), | 174 is_unknown_version_(is_unknown_version), |
| 178 version_(version), | 175 version_(version), |
| 179 payload_(payload), | 176 payload_(payload), |
| 180 ack_handle_(ack_handle) {} | 177 ack_handle_(ack_handle) {} |
| 181 | 178 |
| 182 } // namespace syncer | 179 } // namespace syncer |
| OLD | NEW |