| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 8 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| 9 #define CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 9 #define CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(WorkerThreadVars); | 87 DISALLOW_COPY_AND_ASSIGN(WorkerThreadVars); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 MessageLoop* worker_message_loop(); | 90 MessageLoop* worker_message_loop(); |
| 91 | 91 |
| 92 void CreateWorkerThreadVars( | 92 void CreateWorkerThreadVars( |
| 93 const notifier::NotifierOptions& notifier_options, | 93 const notifier::NotifierOptions& notifier_options, |
| 94 const std::string& client_info); | 94 const std::string& client_info); |
| 95 void DestroyWorkerThreadVars(); | 95 void DestroyWorkerThreadVars(); |
| 96 void CheckOrSetValidThread(); |
| 96 | 97 |
| 97 // Equivalents of the public functions that are run on the worker | 98 // Equivalents of the public functions that are run on the worker |
| 98 // thread. | 99 // thread. |
| 99 void SetStateOnWorkerThread(const std::string& state); | 100 void SetStateOnWorkerThread(const std::string& state); |
| 100 void UpdateCredentialsOnWorkerThread(const std::string& email, | 101 void UpdateCredentialsOnWorkerThread(const std::string& email, |
| 101 const std::string& token); | 102 const std::string& token); |
| 102 void UpdateEnabledTypesOnWorkerThread(const syncable::ModelTypeSet& types); | 103 void UpdateEnabledTypesOnWorkerThread(const syncable::ModelTypeSet& types); |
| 103 | 104 |
| 104 MessageLoop* parent_message_loop_; | 105 MessageLoop* construction_message_loop_; |
| 106 MessageLoop* method_message_loop_; |
| 105 | 107 |
| 106 scoped_refptr<ObserverListThreadSafe<SyncNotifierObserver> > observers_; | 108 scoped_refptr<ObserverListThreadSafe<SyncNotifierObserver> > observers_; |
| 107 | 109 |
| 108 base::Thread worker_thread_; | 110 base::Thread worker_thread_; |
| 109 // Created and destroyed on the worker thread. Not a scoped_ptr as | 111 // Created and destroyed on the worker thread. Not a scoped_ptr as |
| 110 // it's better to leak memory than to delete on the wrong thread. | 112 // it's better to leak memory than to delete on the wrong thread. |
| 111 // Created by CreateWorkerThreadVars() and destroyed by | 113 // Created by CreateWorkerThreadVars() and destroyed by |
| 112 // DestroyWorkerThreadVars(). | 114 // DestroyWorkerThreadVars(). |
| 113 WorkerThreadVars* worker_thread_vars_; | 115 WorkerThreadVars* worker_thread_vars_; |
| 114 | 116 |
| 115 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); | 117 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 } // namespace sync_notifier | 120 } // namespace sync_notifier |
| 119 | 121 |
| 120 // We own our worker thread, so we don't need to be ref-counted. | 122 // We own our worker thread, so we don't need to be ref-counted. |
| 121 DISABLE_RUNNABLE_METHOD_REFCOUNT( | 123 DISABLE_RUNNABLE_METHOD_REFCOUNT( |
| 122 sync_notifier::NonBlockingInvalidationNotifier); | 124 sync_notifier::NonBlockingInvalidationNotifier); |
| 123 | 125 |
| 124 #endif // CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ | 126 #endif // CHROME_BROWSER_SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ |
| OLD | NEW |