OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file defines the "sync API", an interface to the syncer | 5 // This file defines the "sync API", an interface to the syncer |
6 // backend that exposes (1) the core functionality of maintaining a consistent | 6 // backend that exposes (1) the core functionality of maintaining a consistent |
7 // local snapshot of a hierarchical object set; (2) a means to transactionally | 7 // local snapshot of a hierarchical object set; (2) a means to transactionally |
8 // access and modify those objects; (3) a means to control client/server | 8 // access and modify those objects; (3) a means to control client/server |
9 // synchronization tasks, namely: pushing local object modifications to a | 9 // synchronization tasks, namely: pushing local object modifications to a |
10 // server, pulling nonlocal object modifications from a server to this client, | 10 // server, pulling nonlocal object modifications from a server to this client, |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Consequently, it does not support looking up an object by title | 32 // Consequently, it does not support looking up an object by title |
33 // and parent, since such a lookup is not uniquely determined. Lastly, | 33 // and parent, since such a lookup is not uniquely determined. Lastly, |
34 // unlike a filesystem model, objects in the Sync API model have a strict | 34 // unlike a filesystem model, objects in the Sync API model have a strict |
35 // ordering within a parent; the position is manipulable by callers, and | 35 // ordering within a parent; the position is manipulable by callers, and |
36 // children of a node can be enumerated in the order of their position. | 36 // children of a node can be enumerated in the order of their position. |
37 | 37 |
38 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 38 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
39 #define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 39 #define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
40 | 40 |
41 #include "base/basictypes.h" | 41 #include "base/basictypes.h" |
| 42 #include "base/file_path.h" |
42 #include "build/build_config.h" | 43 #include "build/build_config.h" |
43 | 44 |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 typedef wchar_t sync_char16; | 46 typedef wchar_t sync_char16; |
46 #else | 47 #else |
47 typedef uint16 sync_char16; | 48 typedef uint16 sync_char16; |
48 #endif | 49 #endif |
49 | 50 |
50 // The MSVC compiler for Windows requires that any classes exported by, or | 51 // The MSVC compiler for Windows requires that any classes exported by, or |
51 // imported from, a dynamic library be marked with an appropriate | 52 // imported from, a dynamic library be marked with an appropriate |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // code live on separate threads that run simultaneously, we just dedicate | 517 // code live on separate threads that run simultaneously, we just dedicate |
517 // one to each component. Long term we may want to reconsider the HttpBridge | 518 // one to each component. Long term we may want to reconsider the HttpBridge |
518 // API to take all the params in one chunk in a threadsafe manner.. which is | 519 // API to take all the params in one chunk in a threadsafe manner.. which is |
519 // still suboptimal as there will be high contention between the two threads | 520 // still suboptimal as there will be high contention between the two threads |
520 // on startup; so maybe what we have now is the best solution- it does mirror | 521 // on startup; so maybe what we have now is the best solution- it does mirror |
521 // the CURL implementation as each thread creates their own internet handle. | 522 // the CURL implementation as each thread creates their own internet handle. |
522 // Investigate. | 523 // Investigate. |
523 // |model_safe_worker| ownership is given to the SyncManager. | 524 // |model_safe_worker| ownership is given to the SyncManager. |
524 // |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent | 525 // |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent |
525 // HTTP header. Used internally when collecting stats to classify clients. | 526 // HTTP header. Used internally when collecting stats to classify clients. |
526 bool Init(const sync_char16* database_location, | 527 bool Init(const FilePath& database_location, |
527 const char* sync_server_and_path, | 528 const char* sync_server_and_path, |
528 int sync_server_port, | 529 int sync_server_port, |
529 const char* gaia_service_id, | 530 const char* gaia_service_id, |
530 const char* gaia_source, | 531 const char* gaia_source, |
531 bool use_ssl, | 532 bool use_ssl, |
532 HttpPostProviderFactory* post_factory, | 533 HttpPostProviderFactory* post_factory, |
533 HttpPostProviderFactory* auth_post_factory, | 534 HttpPostProviderFactory* auth_post_factory, |
534 ModelSafeWorkerInterface* model_safe_worker, | 535 ModelSafeWorkerInterface* model_safe_worker, |
535 bool attempt_last_user_authentication, | 536 bool attempt_last_user_authentication, |
536 const char* user_agent); | 537 const char* user_agent); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 // Subclasses should implement to invoke DoWork on |visitor| once on a thread | 684 // Subclasses should implement to invoke DoWork on |visitor| once on a thread |
684 // appropriate for data model modifications. | 685 // appropriate for data model modifications. |
685 // While it doesn't hurt, the impl does not need to be re-entrant (for now). | 686 // While it doesn't hurt, the impl does not need to be re-entrant (for now). |
686 // Note: |visitor| is owned by caller. | 687 // Note: |visitor| is owned by caller. |
687 virtual void CallDoWorkFromModelSafeThreadAndWait(Visitor* visitor) = 0; | 688 virtual void CallDoWorkFromModelSafeThreadAndWait(Visitor* visitor) = 0; |
688 }; | 689 }; |
689 | 690 |
690 } // namespace sync_api | 691 } // namespace sync_api |
691 | 692 |
692 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 693 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |