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

Side by Side Diff: sync/notifier/invalidator_registrar.cc

Issue 11046008: [Invalidations] Require there to be no registered handlers on Invalidator destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to HEAD Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « sync/notifier/invalidator_registrar.h ('k') | sync/notifier/invalidator_registrar_unittest.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/notifier/invalidator_registrar.h" 5 #include "sync/notifier/invalidator_registrar.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 11
12 namespace syncer { 12 namespace syncer {
13 13
14 InvalidatorRegistrar::InvalidatorRegistrar() 14 InvalidatorRegistrar::InvalidatorRegistrar()
15 : state_(DEFAULT_INVALIDATION_ERROR) {} 15 : state_(DEFAULT_INVALIDATION_ERROR) {}
16 16
17 InvalidatorRegistrar::~InvalidatorRegistrar() { 17 InvalidatorRegistrar::~InvalidatorRegistrar() {
18 DCHECK(thread_checker_.CalledOnValidThread()); 18 DCHECK(thread_checker_.CalledOnValidThread());
19 CHECK(!handlers_.might_have_observers());
20 // |id_to_handler_map_| may be non-empty but that's okay.
19 } 21 }
20 22
21 void InvalidatorRegistrar::RegisterHandler(InvalidationHandler* handler) { 23 void InvalidatorRegistrar::RegisterHandler(InvalidationHandler* handler) {
22 DCHECK(thread_checker_.CalledOnValidThread()); 24 DCHECK(thread_checker_.CalledOnValidThread());
23 CHECK(handler); 25 CHECK(handler);
24 CHECK(!handlers_.HasObserver(handler)); 26 CHECK(!handlers_.HasObserver(handler));
25 handlers_.AddObserver(handler); 27 handlers_.AddObserver(handler);
26 } 28 }
27 29
28 void InvalidatorRegistrar::UpdateRegisteredIds( 30 void InvalidatorRegistrar::UpdateRegisteredIds(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 142 }
141 143
142 InvalidationHandler* InvalidatorRegistrar::ObjectIdToHandler( 144 InvalidationHandler* InvalidatorRegistrar::ObjectIdToHandler(
143 const invalidation::ObjectId& id) { 145 const invalidation::ObjectId& id) {
144 DCHECK(thread_checker_.CalledOnValidThread()); 146 DCHECK(thread_checker_.CalledOnValidThread());
145 IdHandlerMap::const_iterator it = id_to_handler_map_.find(id); 147 IdHandlerMap::const_iterator it = id_to_handler_map_.find(id);
146 return (it == id_to_handler_map_.end()) ? NULL : it->second; 148 return (it == id_to_handler_map_.end()) ? NULL : it->second;
147 } 149 }
148 150
149 } // namespace syncer 151 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/notifier/invalidator_registrar.h ('k') | sync/notifier/invalidator_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698