| 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 #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ | 6 #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "chrome/browser/sync/engine/model_safe_worker.h" | 14 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 15 #include "chrome/browser/sync/syncable/model_type.h" | 15 #include "chrome/browser/sync/syncable/model_type.h" |
| 16 #include "chrome/browser/sync/unrecoverable_error_handler.h" | 16 #include "chrome/browser/sync/unrecoverable_error_handler.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 | 18 |
| 19 class SyncError; | 19 class SyncError; |
| 20 | 20 |
| 21 namespace browser_sync { | 21 namespace browser_sync { |
| 22 | 22 |
| 23 // Data type controllers need to be refcounted threadsafe, as they may | 23 // Data type controllers need to be refcounted threadsafe, as they may |
| 24 // need to run model associator or change processor on other threads. | 24 // need to run model associator or change processor on other threads. |
| 25 class DataTypeController | 25 class DataTypeController |
| 26 : public base::RefCountedThreadSafe<DataTypeController, | 26 : public base::RefCountedThreadSafe< |
| 27 BrowserThread::DeleteOnUIThread>, | 27 DataTypeController, content::BrowserThread::DeleteOnUIThread>, |
| 28 public UnrecoverableErrorHandler { | 28 public UnrecoverableErrorHandler { |
| 29 public: | 29 public: |
| 30 enum State { | 30 enum State { |
| 31 NOT_RUNNING, // The controller has never been started or has | 31 NOT_RUNNING, // The controller has never been started or has |
| 32 // previously been stopped. Must be in this state to start. | 32 // previously been stopped. Must be in this state to start. |
| 33 MODEL_STARTING, // The controller is waiting on dependent services | 33 MODEL_STARTING, // The controller is waiting on dependent services |
| 34 // that need to be available before model | 34 // that need to be available before model |
| 35 // association. | 35 // association. |
| 36 ASSOCIATING, // Model association is in progress. | 36 ASSOCIATING, // Model association is in progress. |
| 37 RUNNING, // The controller is running and the data type is | 37 RUNNING, // The controller is running and the data type is |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // The model safe group of this data type. This should reflect the | 86 // The model safe group of this data type. This should reflect the |
| 87 // thread that should be used to modify the data type's native | 87 // thread that should be used to modify the data type's native |
| 88 // model. | 88 // model. |
| 89 virtual browser_sync::ModelSafeGroup model_safe_group() const = 0; | 89 virtual browser_sync::ModelSafeGroup model_safe_group() const = 0; |
| 90 | 90 |
| 91 // Current state of the data type controller. | 91 // Current state of the data type controller. |
| 92 virtual State state() const = 0; | 92 virtual State state() const = 0; |
| 93 | 93 |
| 94 protected: | 94 protected: |
| 95 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 95 friend struct content::BrowserThread::DeleteOnThread< |
| 96 content::BrowserThread::UI>; |
| 96 friend class DeleteTask<DataTypeController>; | 97 friend class DeleteTask<DataTypeController>; |
| 97 friend class ShutdownTask; | 98 friend class ShutdownTask; |
| 98 | 99 |
| 99 virtual ~DataTypeController() {} | 100 virtual ~DataTypeController() {} |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 } // namespace browser_sync | 103 } // namespace browser_sync |
| 103 | 104 |
| 104 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ | 105 #endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ |
| OLD | NEW |