Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: sync/tools/null_invalidation_state_tracker.cc

Issue 56113003: Implement new invalidations ack tracking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify drive TODO comment + rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/tools/null_invalidation_state_tracker.h ('k') | sync/tools/sync_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/tools/null_invalidation_state_tracker.h" 5 #include "sync/tools/null_invalidation_state_tracker.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/task_runner.h" 12 #include "base/task_runner.h"
13 #include "sync/notifier/invalidation_util.h" 13 #include "sync/notifier/invalidation_util.h"
14 14
15 namespace syncer { 15 namespace syncer {
16 16
17 NullInvalidationStateTracker::NullInvalidationStateTracker() {} 17 NullInvalidationStateTracker::NullInvalidationStateTracker() {}
18 NullInvalidationStateTracker::~NullInvalidationStateTracker() {} 18 NullInvalidationStateTracker::~NullInvalidationStateTracker() {}
19 19
20 InvalidationStateMap
21 NullInvalidationStateTracker::GetAllInvalidationStates() const {
22 return InvalidationStateMap();
23 }
24
25 void NullInvalidationStateTracker::SetMaxVersionAndPayload(
26 const invalidation::ObjectId& id,
27 int64 max_invalidation_version,
28 const std::string& payload) {
29 LOG(INFO) << "Setting max invalidation version for "
30 << ObjectIdToString(id) << " to " << max_invalidation_version
31 << " with payload " << payload;
32 }
33
34 void NullInvalidationStateTracker::Forget(const ObjectIdSet& ids) {
35 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
36 LOG(INFO) << "Forgetting invalidation state for " << ObjectIdToString(*it);
37 }
38 }
39
40 void NullInvalidationStateTracker::SetInvalidatorClientId( 20 void NullInvalidationStateTracker::SetInvalidatorClientId(
41 const std::string& data) { 21 const std::string& data) {
42 LOG(INFO) << "Setting invalidator client ID to: " << data; 22 LOG(INFO) << "Setting invalidator client ID to: " << data;
43 } 23 }
44 24
45 std::string NullInvalidationStateTracker::GetInvalidatorClientId() const { 25 std::string NullInvalidationStateTracker::GetInvalidatorClientId() const {
46 // The caller of this function is probably looking for an ID it can use to 26 // The caller of this function is probably looking for an ID it can use to
47 // identify this client as the originator of some notifiable change. It does 27 // identify this client as the originator of some notifiable change. It does
48 // this so the invalidation server can prevent it from being notified of its 28 // this so the invalidation server can prevent it from being notified of its
49 // own changes. This invalidation state tracker doesn't remember its ID, so 29 // own changes. This invalidation state tracker doesn't remember its ID, so
50 // it can't support this feature. 30 // it can't support this feature.
51 NOTREACHED() << "This state tracker does not support reflection-blocking"; 31 NOTREACHED() << "This state tracker does not support reflection-blocking";
52 return std::string(); 32 return std::string();
53 } 33 }
54 34
55 std::string NullInvalidationStateTracker::GetBootstrapData() const { 35 std::string NullInvalidationStateTracker::GetBootstrapData() const {
56 return std::string(); 36 return std::string();
57 } 37 }
58 38
59 void NullInvalidationStateTracker::SetBootstrapData(const std::string& data) { 39 void NullInvalidationStateTracker::SetBootstrapData(const std::string& data) {
60 std::string base64_data; 40 std::string base64_data;
61 CHECK(base::Base64Encode(data, &base64_data)); 41 CHECK(base::Base64Encode(data, &base64_data));
62 LOG(INFO) << "Setting bootstrap data to: " << base64_data; 42 LOG(INFO) << "Setting bootstrap data to: " << base64_data;
63 } 43 }
64 44
65 void NullInvalidationStateTracker::Clear() { 45 void NullInvalidationStateTracker::Clear() {
66 // We have no members to clear. 46 // We have no members to clear.
67 } 47 }
68 48
69 void NullInvalidationStateTracker::GenerateAckHandles( 49 void NullInvalidationStateTracker::SetSavedInvalidations(
70 const ObjectIdSet& ids, 50 const UnackedInvalidationsMap& states) {
71 const scoped_refptr<base::TaskRunner>& task_runner, 51 // Do nothing.
72 base::Callback<void(const AckHandleMap&)> callback) {
73 AckHandleMap ack_handles;
74 for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) {
75 ack_handles.insert(std::make_pair(*it, AckHandle::InvalidAckHandle()));
76 }
77 CHECK(task_runner->PostTask(FROM_HERE, base::Bind(callback, ack_handles)));
78 } 52 }
79 53
80 void NullInvalidationStateTracker::Acknowledge(const invalidation::ObjectId& id, 54 UnackedInvalidationsMap
81 const AckHandle& ack_handle) { 55 NullInvalidationStateTracker::GetSavedInvalidations() const {
82 LOG(INFO) << "Received ack for " << ObjectIdToString(id); 56 return UnackedInvalidationsMap();
83 } 57 }
84 58
85 } // namespace syncer 59 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/tools/null_invalidation_state_tracker.h ('k') | sync/tools/sync_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698