| OLD | NEW |
| 1 // Copyright (c) 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 SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ |
| 10 #define SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ | 10 #define SYNC_NOTIFIER_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.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
| 21 #include "google/cacheinvalidation/include/system-resources.h" | 21 #include "google/cacheinvalidation/include/system-resources.h" |
| 22 #include "sync/base/sync_export.h" |
| 22 #include "sync/notifier/push_client_channel.h" | 23 #include "sync/notifier/push_client_channel.h" |
| 23 #include "sync/notifier/state_writer.h" | 24 #include "sync/notifier/state_writer.h" |
| 24 | 25 |
| 25 namespace notifier { | 26 namespace notifier { |
| 26 class PushClient; | 27 class PushClient; |
| 27 } // namespace notifier | 28 } // namespace notifier |
| 28 | 29 |
| 29 namespace syncer { | 30 namespace syncer { |
| 30 | 31 |
| 31 class SyncLogger : public invalidation::Logger { | 32 class SyncLogger : public invalidation::Logger { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 110 |
| 110 // Runs the given callback with the given value and deletes it. | 111 // Runs the given callback with the given value and deletes it. |
| 111 void RunAndDeleteReadKeyCallback( | 112 void RunAndDeleteReadKeyCallback( |
| 112 invalidation::ReadKeyCallback* callback, const std::string& value); | 113 invalidation::ReadKeyCallback* callback, const std::string& value); |
| 113 | 114 |
| 114 StateWriter* state_writer_; | 115 StateWriter* state_writer_; |
| 115 invalidation::Scheduler* scheduler_; | 116 invalidation::Scheduler* scheduler_; |
| 116 std::string cached_state_; | 117 std::string cached_state_; |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 class SyncSystemResources : public invalidation::SystemResources { | 120 class SYNC_EXPORT_PRIVATE SyncSystemResources |
| 121 : public NON_EXPORTED_BASE(invalidation::SystemResources) { |
| 120 public: | 122 public: |
| 121 SyncSystemResources(scoped_ptr<notifier::PushClient> push_client, | 123 SyncSystemResources(scoped_ptr<notifier::PushClient> push_client, |
| 122 StateWriter* state_writer); | 124 StateWriter* state_writer); |
| 123 | 125 |
| 124 virtual ~SyncSystemResources(); | 126 virtual ~SyncSystemResources(); |
| 125 | 127 |
| 126 // invalidation::SystemResources implementation. | 128 // invalidation::SystemResources implementation. |
| 127 virtual void Start() OVERRIDE; | 129 virtual void Start() OVERRIDE; |
| 128 virtual void Stop() OVERRIDE; | 130 virtual void Stop() OVERRIDE; |
| 129 virtual bool IsStarted() const OVERRIDE; | 131 virtual bool IsStarted() const OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 141 scoped_ptr<SyncLogger> logger_; | 143 scoped_ptr<SyncLogger> logger_; |
| 142 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_; | 144 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_; |
| 143 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_; | 145 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_; |
| 144 scoped_ptr<SyncStorage> storage_; | 146 scoped_ptr<SyncStorage> storage_; |
| 145 PushClientChannel push_client_channel_; | 147 PushClientChannel push_client_channel_; |
| 146 }; | 148 }; |
| 147 | 149 |
| 148 } // namespace syncer | 150 } // namespace syncer |
| 149 | 151 |
| 150 #endif // SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ | 152 #endif // SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ |
| OLD | NEW |