| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "components/sync_driver/backend_data_type_configurer.h" | 15 #include "components/sync_driver/backend_data_type_configurer.h" |
| 16 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
| 17 #include "sync/internal_api/public/configure_reason.h" | 17 #include "sync/internal_api/public/configure_reason.h" |
| 18 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 18 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
| 19 #include "sync/internal_api/public/shutdown_reason.h" |
| 19 #include "sync/internal_api/public/sync_context_proxy.h" | 20 #include "sync/internal_api/public/sync_context_proxy.h" |
| 20 #include "sync/internal_api/public/sync_manager.h" | 21 #include "sync/internal_api/public/sync_manager.h" |
| 21 #include "sync/internal_api/public/sync_manager_factory.h" | 22 #include "sync/internal_api/public/sync_manager_factory.h" |
| 22 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" | 23 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
| 23 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 24 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 24 #include "sync/internal_api/public/util/weak_handle.h" | 25 #include "sync/internal_api/public/util/weak_handle.h" |
| 25 | 26 |
| 26 class GURL; | 27 class GURL; |
| 27 | 28 |
| 28 namespace base { | 29 namespace base { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 virtual bool SetDecryptionPassphrase(const std::string& passphrase) | 109 virtual bool SetDecryptionPassphrase(const std::string& passphrase) |
| 109 WARN_UNUSED_RESULT = 0; | 110 WARN_UNUSED_RESULT = 0; |
| 110 | 111 |
| 111 // Called on |frontend_loop_| to kick off shutdown procedure. Attempts to cut | 112 // Called on |frontend_loop_| to kick off shutdown procedure. Attempts to cut |
| 112 // short any long-lived or blocking sync thread tasks so that the shutdown on | 113 // short any long-lived or blocking sync thread tasks so that the shutdown on |
| 113 // sync thread task that we're about to post won't have to wait very long. | 114 // sync thread task that we're about to post won't have to wait very long. |
| 114 virtual void StopSyncingForShutdown() = 0; | 115 virtual void StopSyncingForShutdown() = 0; |
| 115 | 116 |
| 116 // Called on |frontend_loop_| to kick off shutdown. | 117 // Called on |frontend_loop_| to kick off shutdown. |
| 117 // See the implementation and Core::DoShutdown for details. | 118 // See the implementation and Core::DoShutdown for details. |
| 118 // Must be called *after* StopSyncingForShutdown. Caller should claim sync | 119 // Must be called *after* StopSyncingForShutdown. |
| 119 // thread using STOP_AND_CLAIM_THREAD or DISABLE_AND_CLAIM_THREAD if sync | 120 // For any reason other than BROWSER_SHUTDOWN, caller should claim sync |
| 120 // backend might be recreated later because otherwise: | 121 // thread because: |
| 121 // * sync loop may be stopped on main loop and cause it to be blocked. | 122 // * during browser shutdown sync thread is not claimed to avoid blocking |
| 122 // * new/old backend may interfere with each other if new backend is created | 123 // browser shutdown on sync shutdown. |
| 123 // before old one finishes cleanup. | 124 // * otherwise sync thread is claimed so that if sync backend is recreated |
| 124 enum ShutdownOption { | 125 // later, initialization of new backend is serialized on previous sync |
| 125 STOP, // Stop syncing and let backend stop sync thread. | 126 // thread after cleanup of previous backend to avoid old/new backends |
| 126 STOP_AND_CLAIM_THREAD, // Stop syncing and return sync thread. | 127 // interfere with each other. |
| 127 DISABLE_AND_CLAIM_THREAD, // Disable sync and return sync thread. | 128 virtual scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) = 0; |
| 128 }; | |
| 129 virtual scoped_ptr<base::Thread> Shutdown(ShutdownOption option) = 0; | |
| 130 | 129 |
| 131 // Removes all current registrations from the backend on the | 130 // Removes all current registrations from the backend on the |
| 132 // InvalidationService. | 131 // InvalidationService. |
| 133 virtual void UnregisterInvalidationIds() = 0; | 132 virtual void UnregisterInvalidationIds() = 0; |
| 134 | 133 |
| 135 // Changes the set of data types that are currently being synced. | 134 // Changes the set of data types that are currently being synced. |
| 136 // The ready_task will be run when configuration is done with the | 135 // The ready_task will be run when configuration is done with the |
| 137 // set of all types that failed configuration (i.e., if its argument | 136 // set of all types that failed configuration (i.e., if its argument |
| 138 // is non-empty, then an error was encountered). | 137 // is non-empty, then an error was encountered). |
| 139 virtual void ConfigureDataTypes( | 138 virtual void ConfigureDataTypes( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 virtual void DisableDirectoryTypeDebugInfoForwarding() = 0; | 215 virtual void DisableDirectoryTypeDebugInfoForwarding() = 0; |
| 217 | 216 |
| 218 virtual base::MessageLoop* GetSyncLoopForTesting() = 0; | 217 virtual base::MessageLoop* GetSyncLoopForTesting() = 0; |
| 219 | 218 |
| 220 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 219 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 221 }; | 220 }; |
| 222 | 221 |
| 223 } // namespace browser_sync | 222 } // namespace browser_sync |
| 224 | 223 |
| 225 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 224 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |