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

Side by Side Diff: components/invalidation/sync_system_resources.h

Issue 294123004: Move some sync/notifier to components/invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
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 // Simple system resources class that uses the current message loop 5 // Simple system resources class that uses the current message loop
6 // for scheduling. Assumes the current message loop is already 6 // for scheduling. Assumes the current message loop is already
7 // running. 7 // running.
8 8
9 #ifndef SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ 9 #ifndef COMPONENTS_INVALIDATION_SYNC_SYSTEM_RESOURCES_H_
10 #define SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ 10 #define COMPONENTS_INVALIDATION_SYNC_SYSTEM_RESOURCES_H_
11 11
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/message_loop/message_loop.h" 19 #include "base/message_loop/message_loop.h"
20 #include "base/threading/non_thread_safe.h" 20 #include "base/threading/non_thread_safe.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "components/invalidation/invalidation_export.h"
23 #include "components/invalidation/state_writer.h"
22 #include "google/cacheinvalidation/include/system-resources.h" 24 #include "google/cacheinvalidation/include/system-resources.h"
23 #include "jingle/notifier/base/notifier_options.h" 25 #include "jingle/notifier/base/notifier_options.h"
24 #include "sync/base/sync_export.h" 26 #include "sync/internal_api/public/base/invalidator_state.h"
25 #include "sync/notifier/invalidator_state.h"
26 #include "sync/notifier/state_writer.h"
27 27
28 namespace syncer { 28 namespace syncer {
29 29
30 class GCMNetworkChannelDelegate; 30 class GCMNetworkChannelDelegate;
31 31
32 class SyncLogger : public invalidation::Logger { 32 class SyncLogger : public invalidation::Logger {
33 public: 33 public:
34 SyncLogger(); 34 SyncLogger();
35 35
36 virtual ~SyncLogger(); 36 virtual ~SyncLogger();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_; 78 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_;
79 }; 79 };
80 80
81 // SyncNetworkChannel implements common tasks needed to interact with 81 // SyncNetworkChannel implements common tasks needed to interact with
82 // invalidation library: 82 // invalidation library:
83 // - registering message and network status callbacks 83 // - registering message and network status callbacks
84 // - notifying observers about network channel state change 84 // - notifying observers about network channel state change
85 // Implementation of particular network protocol should implement 85 // Implementation of particular network protocol should implement
86 // SendMessage and call NotifyStateChange and DeliverIncomingMessage. 86 // SendMessage and call NotifyStateChange and DeliverIncomingMessage.
87 class SYNC_EXPORT_PRIVATE SyncNetworkChannel 87 class INVALIDATION_EXPORT_PRIVATE SyncNetworkChannel
88 : public NON_EXPORTED_BASE(invalidation::NetworkChannel) { 88 : public NON_EXPORTED_BASE(invalidation::NetworkChannel) {
89 public: 89 public:
90 class Observer { 90 class Observer {
91 public: 91 public:
92 // Called when network channel state changes. Possible states are: 92 // Called when network channel state changes. Possible states are:
93 // - INVALIDATIONS_ENABLED : connection is established and working 93 // - INVALIDATIONS_ENABLED : connection is established and working
94 // - TRANSIENT_INVALIDATION_ERROR : no network, connection lost, etc. 94 // - TRANSIENT_INVALIDATION_ERROR : no network, connection lost, etc.
95 // - INVALIDATION_CREDENTIALS_REJECTED : Issues with auth token 95 // - INVALIDATION_CREDENTIALS_REJECTED : Issues with auth token
96 virtual void OnNetworkChannelStateChanged( 96 virtual void OnNetworkChannelStateChanged(
97 InvalidatorState invalidator_state) = 0; 97 InvalidatorState invalidator_state) = 0;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 // Runs the given callback with the given value and deletes it. 199 // Runs the given callback with the given value and deletes it.
200 void RunAndDeleteReadKeyCallback( 200 void RunAndDeleteReadKeyCallback(
201 invalidation::ReadKeyCallback* callback, const std::string& value); 201 invalidation::ReadKeyCallback* callback, const std::string& value);
202 202
203 StateWriter* state_writer_; 203 StateWriter* state_writer_;
204 invalidation::Scheduler* scheduler_; 204 invalidation::Scheduler* scheduler_;
205 std::string cached_state_; 205 std::string cached_state_;
206 }; 206 };
207 207
208 class SYNC_EXPORT_PRIVATE SyncSystemResources 208 class INVALIDATION_EXPORT_PRIVATE SyncSystemResources
209 : public NON_EXPORTED_BASE(invalidation::SystemResources) { 209 : public NON_EXPORTED_BASE(invalidation::SystemResources) {
210 public: 210 public:
211 SyncSystemResources(SyncNetworkChannel* sync_network_channel, 211 SyncSystemResources(SyncNetworkChannel* sync_network_channel,
212 StateWriter* state_writer); 212 StateWriter* state_writer);
213 213
214 virtual ~SyncSystemResources(); 214 virtual ~SyncSystemResources();
215 215
216 // invalidation::SystemResources implementation. 216 // invalidation::SystemResources implementation.
217 virtual void Start() OVERRIDE; 217 virtual void Start() OVERRIDE;
218 virtual void Stop() OVERRIDE; 218 virtual void Stop() OVERRIDE;
(...skipping 12 matching lines...) Expand all
231 scoped_ptr<SyncLogger> logger_; 231 scoped_ptr<SyncLogger> logger_;
232 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_; 232 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_;
233 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_; 233 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_;
234 scoped_ptr<SyncStorage> storage_; 234 scoped_ptr<SyncStorage> storage_;
235 // sync_network_channel_ is owned by SyncInvalidationListener. 235 // sync_network_channel_ is owned by SyncInvalidationListener.
236 SyncNetworkChannel* sync_network_channel_; 236 SyncNetworkChannel* sync_network_channel_;
237 }; 237 };
238 238
239 } // namespace syncer 239 } // namespace syncer
240 240
241 #endif // SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ 241 #endif // COMPONENTS_INVALIDATION_SYNC_SYSTEM_RESOURCES_H_
OLDNEW
« no previous file with comments | « components/invalidation/sync_invalidation_listener_unittest.cc ('k') | components/invalidation/sync_system_resources.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698