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

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

Issue 140513002: Client-to-server messages in GCMNetworkChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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 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 // An implementation of SyncNotifier that wraps InvalidationNotifier 5 // An implementation of SyncNotifier that wraps InvalidationNotifier
6 // on its own thread. 6 // on its own thread.
7 7
8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ 8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_
9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ 9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_
10 10
(...skipping 11 matching lines...) Expand all
22 #include "sync/notifier/invalidation_state_tracker.h" 22 #include "sync/notifier/invalidation_state_tracker.h"
23 #include "sync/notifier/invalidator.h" 23 #include "sync/notifier/invalidator.h"
24 #include "sync/notifier/invalidator_registrar.h" 24 #include "sync/notifier/invalidator_registrar.h"
25 25
26 namespace base { 26 namespace base {
27 class SingleThreadTaskRunner; 27 class SingleThreadTaskRunner;
28 } // namespace base 28 } // namespace base
29 29
30 namespace syncer { 30 namespace syncer {
31 class SyncNetworkChannel; 31 class SyncNetworkChannel;
32 class GCMNetworkChannelDelegate;
32 33
33 // Callback type for function that creates SyncNetworkChannel. This function 34 // Callback type for function that creates SyncNetworkChannel. This function
34 // gets passed into NonBlockingInvalidator constructor. 35 // gets passed into NonBlockingInvalidator constructor.
35 typedef base::Callback<scoped_ptr<SyncNetworkChannel>(void)> 36 typedef base::Callback<scoped_ptr<SyncNetworkChannel>(void)>
36 NetworkChannelCreator; 37 NetworkChannelCreator;
37 38
38 class SYNC_EXPORT_PRIVATE NonBlockingInvalidator 39 class SYNC_EXPORT_PRIVATE NonBlockingInvalidator
39 : public Invalidator, 40 : public Invalidator,
40 // InvalidationHandler to "observe" our Core via WeakHandle. 41 // InvalidationHandler to "observe" our Core via WeakHandle.
41 public InvalidationHandler { 42 public InvalidationHandler {
(...skipping 25 matching lines...) Expand all
67 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE; 68 virtual void OnInvalidatorStateChange(InvalidatorState state) OVERRIDE;
68 virtual void OnIncomingInvalidation( 69 virtual void OnIncomingInvalidation(
69 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; 70 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
70 71
71 // Static functions to construct callback that creates network channel for 72 // Static functions to construct callback that creates network channel for
72 // SyncSystemResources. The goal is to pass network channel to invalidator at 73 // SyncSystemResources. The goal is to pass network channel to invalidator at
73 // the same time not exposing channel specific parameters to invalidator and 74 // the same time not exposing channel specific parameters to invalidator and
74 // channel implementation to client of invalidator. 75 // channel implementation to client of invalidator.
75 static NetworkChannelCreator MakePushClientChannelCreator( 76 static NetworkChannelCreator MakePushClientChannelCreator(
76 const notifier::NotifierOptions& notifier_options); 77 const notifier::NotifierOptions& notifier_options);
77 static NetworkChannelCreator MakeGCMNetworkChannelCreator(); 78 static NetworkChannelCreator MakeGCMNetworkChannelCreator(
79 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
80 scoped_ptr<GCMNetworkChannelDelegate> delegate);
78 private: 81 private:
79 struct InitializeOptions; 82 struct InitializeOptions;
80 class Core; 83 class Core;
81 84
82 InvalidatorRegistrar registrar_; 85 InvalidatorRegistrar registrar_;
83 86
84 // The real guts of NonBlockingInvalidator, which allows this class to live 87 // The real guts of NonBlockingInvalidator, which allows this class to live
85 // completely on the parent thread. 88 // completely on the parent thread.
86 scoped_refptr<Core> core_; 89 scoped_refptr<Core> core_;
87 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_; 90 scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner_;
88 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; 91 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
89 92
90 base::WeakPtrFactory<NonBlockingInvalidator> weak_ptr_factory_; 93 base::WeakPtrFactory<NonBlockingInvalidator> weak_ptr_factory_;
91 94
92 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator); 95 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidator);
93 }; 96 };
94 97
95 } // namespace syncer 98 } // namespace syncer
96 99
97 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_ 100 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698