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

Side by Side Diff: components/invalidation/mock_ack_handler.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/invalidation/mock_ack_handler.h" 5 #include "components/invalidation/mock_ack_handler.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "components/invalidation/ack_handle.h" 8 #include "components/invalidation/ack_handle.h"
9 #include "components/invalidation/invalidation.h" 9 #include "components/invalidation/invalidation.h"
10 10
11 namespace syncer { 11 namespace syncer {
12 12
13 namespace { 13 namespace {
14 14
15 struct AckHandleMatcher { 15 struct AckHandleMatcher {
16 AckHandleMatcher(const AckHandle& handle); 16 AckHandleMatcher(const AckHandle& handle);
17 bool operator()(const syncer::Invalidation& invalidation) const; 17 bool operator()(const syncer::Invalidation& invalidation) const;
(...skipping 10 matching lines...) Expand all
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 MockAckHandler::MockAckHandler() {} 32 MockAckHandler::MockAckHandler() {}
33 33
34 MockAckHandler::~MockAckHandler() {} 34 MockAckHandler::~MockAckHandler() {}
35 35
36 void MockAckHandler::RegisterInvalidation(Invalidation* invalidation) { 36 void MockAckHandler::RegisterInvalidation(Invalidation* invalidation) {
37 unacked_invalidations_.push_back(*invalidation); 37 unacked_invalidations_.push_back(*invalidation);
38 invalidation->SetAckHandler(AsWeakPtr(), base::MessageLoopProxy::current()); 38 invalidation->SetAckHandler(AsWeakPtr(), base::ThreadTaskRunnerHandle::Get());
39 } 39 }
40 40
41 void MockAckHandler::RegisterUnsentInvalidation(Invalidation* invalidation) { 41 void MockAckHandler::RegisterUnsentInvalidation(Invalidation* invalidation) {
42 unsent_invalidations_.push_back(*invalidation); 42 unsent_invalidations_.push_back(*invalidation);
43 } 43 }
44 44
45 bool MockAckHandler::IsUnacked(const Invalidation& invalidation) const { 45 bool MockAckHandler::IsUnacked(const Invalidation& invalidation) const {
46 AckHandleMatcher matcher(invalidation.ack_handle()); 46 AckHandleMatcher matcher(invalidation.ack_handle());
47 InvalidationVector::const_iterator it = std::find_if( 47 InvalidationVector::const_iterator it = std::find_if(
48 unacked_invalidations_.begin(), 48 unacked_invalidations_.begin(),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 matcher); 111 matcher);
112 if (it != unacked_invalidations_.end()) { 112 if (it != unacked_invalidations_.end()) {
113 dropped_invalidations_.push_back(*it); 113 dropped_invalidations_.push_back(*it);
114 unacked_invalidations_.erase(it); 114 unacked_invalidations_.erase(it);
115 } 115 }
116 unrecovered_drop_events_.erase(id); 116 unrecovered_drop_events_.erase(id);
117 unrecovered_drop_events_.insert(std::make_pair(id, handle)); 117 unrecovered_drop_events_.insert(std::make_pair(id, handle));
118 } 118 }
119 119
120 } // namespace syncer 120 } // namespace syncer
OLDNEW
« no previous file with comments | « components/invalidation/invalidation_notifier_unittest.cc ('k') | components/invalidation/non_blocking_invalidator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698