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

Side by Side Diff: sync/notifier/sync_notifier_helper.h

Issue 10702074: Refactor sync-specific parts out of SyncNotifier/SyncNotifierObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DEPS Created 8 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SYNC_NOTIFIER_SYNC_NOTIFIER_HELPER_H_
6 #define SYNC_NOTIFIER_SYNC_NOTIFIER_HELPER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/observer_list.h"
12 #include "sync/notifier/invalidation_util.h"
13 #include "sync/notifier/object_id_payload_map.h"
14 #include "sync/notifier/sync_notifier_observer.h"
15
16 namespace syncer {
17
18 class SyncNotifierHelper {
akalin 2012/07/19 00:42:07 class-level comment
dcheng 2012/07/19 18:31:05 Done.
19 public:
20 SyncNotifierHelper();
21 virtual ~SyncNotifierHelper();
akalin 2012/07/19 00:42:07 doesn't need to be virtual
dcheng 2012/07/19 18:31:05 Leftover from an earlier patch. We don't need it a
22
23 // Updates the list of ObjectIds associated with a given |handler|. Passing an
24 // empty ObjectIdSet will unregister |handler|; any other value is an implicit
25 // registration. The return value is an ObjectIdSet containing all currently
26 // registered values.
akalin 2012/07/19 00:42:07 was momentarily confused -- maybe '...values.' ->
akalin 2012/07/19 00:42:07 Specify that at most one handler can handle a give
dcheng 2012/07/19 18:31:05 Done.
dcheng 2012/07/19 18:31:05 Done.
27 ObjectIdSet UpdateRegisteredIds(SyncNotifierObserver* handler,
28 const ObjectIdSet& ids);
29
30 // Helper that sorts incoming invalidations into a bucket for each handler
31 // and then dispatches the batched invalidations to the corresponding handler.
32 void DispatchInvalidationsToHandlers(const ObjectIdPayloadMap& id_payloads,
33 IncomingNotificationSource source);
34
35 // Note that this is non-const because FOR_EACH_OBSERVER() may mutate the
akalin 2012/07/19 00:42:07 Would rather replace this accessor with functions
dcheng 2012/07/19 18:31:05 Done.
36 // original observer list.
37 ObserverList<SyncNotifierObserver>* handlers() { return &handlers_; }
38
39 private:
40 typedef std::map<invalidation::ObjectId,
41 SyncNotifierObserver*,
42 ObjectIdLessThan> ObjectIdObserverMap;
43 ObserverList<SyncNotifierObserver> handlers_;
44 ObjectIdObserverMap id_to_handler_map_;
45
46 DISALLOW_COPY_AND_ASSIGN(SyncNotifierHelper);
47 };
48
49 } // namespace syncer
50
51 #endif // SYNC_NOTIFIER_SYNC_NOTIFIER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698