OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/lock.h" | |
15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
16 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "base/synchronization/lock.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/timer.h" | 18 #include "base/timer.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/sync/engine/syncapi.h" | 20 #include "chrome/browser/sync/engine/syncapi.h" |
21 #include "chrome/browser/sync/engine/model_safe_worker.h" | 21 #include "chrome/browser/sync/engine/model_safe_worker.h" |
22 #include "chrome/browser/sync/glue/data_type_controller.h" | 22 #include "chrome/browser/sync/glue/data_type_controller.h" |
23 #include "chrome/browser/sync/glue/ui_model_worker.h" | 23 #include "chrome/browser/sync/glue/ui_model_worker.h" |
24 #include "chrome/browser/sync/syncable/model_type.h" | 24 #include "chrome/browser/sync/syncable/model_type.h" |
25 #include "chrome/common/net/gaia/google_service_auth_error.h" | 25 #include "chrome/common/net/gaia/google_service_auth_error.h" |
26 #include "chrome/common/net/url_request_context_getter.h" | 26 #include "chrome/common/net/url_request_context_getter.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 // The user can incur changes to registrar_ at any time from the UI thread. | 489 // The user can incur changes to registrar_ at any time from the UI thread. |
490 // The syncapi needs to periodically get a consistent snapshot of the state, | 490 // The syncapi needs to periodically get a consistent snapshot of the state, |
491 // and it does so from a different thread. Therefore, we protect creation, | 491 // and it does so from a different thread. Therefore, we protect creation, |
492 // destruction, and re-routing events by acquiring this lock. Note that the | 492 // destruction, and re-routing events by acquiring this lock. Note that the |
493 // SyncBackendHost may read (on the UI thread or core thread) from registrar_ | 493 // SyncBackendHost may read (on the UI thread or core thread) from registrar_ |
494 // without acquiring the lock (which is typically "read ModelSafeWorker | 494 // without acquiring the lock (which is typically "read ModelSafeWorker |
495 // pointer value", and then invoke methods), because lifetimes are managed on | 495 // pointer value", and then invoke methods), because lifetimes are managed on |
496 // the UI thread. Of course, this comment only applies to ModelSafeWorker | 496 // the UI thread. Of course, this comment only applies to ModelSafeWorker |
497 // impls that are themselves thread-safe, such as UIModelWorker. | 497 // impls that are themselves thread-safe, such as UIModelWorker. |
498 mutable Lock registrar_lock_; | 498 mutable base::Lock registrar_lock_; |
499 | 499 |
500 // The frontend which we serve (and are owned by). | 500 // The frontend which we serve (and are owned by). |
501 SyncFrontend* frontend_; | 501 SyncFrontend* frontend_; |
502 | 502 |
503 // The change processors that handle the different data types. | 503 // The change processors that handle the different data types. |
504 std::map<syncable::ModelType, ChangeProcessor*> processors_; | 504 std::map<syncable::ModelType, ChangeProcessor*> processors_; |
505 | 505 |
506 // Path of the folder that stores the sync data files. | 506 // Path of the folder that stores the sync data files. |
507 FilePath sync_data_folder_path_; | 507 FilePath sync_data_folder_path_; |
508 | 508 |
(...skipping 16 matching lines...) Expand all Loading... |
525 | 525 |
526 // Whether we've processed the initialization complete callback. | 526 // Whether we've processed the initialization complete callback. |
527 bool syncapi_initialized_; | 527 bool syncapi_initialized_; |
528 | 528 |
529 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 529 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
530 }; | 530 }; |
531 | 531 |
532 } // namespace browser_sync | 532 } // namespace browser_sync |
533 | 533 |
534 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 534 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |