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 // 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); | 468 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); |
469 }; | 469 }; |
470 | 470 |
471 // Sync API's ReadTransaction is a read-only BaseTransaction. It wraps | 471 // Sync API's ReadTransaction is a read-only BaseTransaction. It wraps |
472 // a syncable::ReadTransaction. | 472 // a syncable::ReadTransaction. |
473 class ReadTransaction : public BaseTransaction { | 473 class ReadTransaction : public BaseTransaction { |
474 public: | 474 public: |
475 // Start a new read-only transaction on the specified repository. | 475 // Start a new read-only transaction on the specified repository. |
476 explicit ReadTransaction(UserShare* share); | 476 explicit ReadTransaction(UserShare* share); |
| 477 |
| 478 // Resume the middle of a transaction. Will not close transaction. |
| 479 ReadTransaction(UserShare* share, syncable::BaseTransaction* trans); |
| 480 |
477 virtual ~ReadTransaction(); | 481 virtual ~ReadTransaction(); |
478 | 482 |
479 // BaseTransaction override. | 483 // BaseTransaction override. |
480 virtual syncable::BaseTransaction* GetWrappedTrans() const; | 484 virtual syncable::BaseTransaction* GetWrappedTrans() const; |
481 private: | 485 private: |
482 void* operator new(size_t size); // Transaction is meant for stack use only. | 486 void* operator new(size_t size); // Transaction is meant for stack use only. |
483 | 487 |
484 // The underlying syncable object which this class wraps. | 488 // The underlying syncable object which this class wraps. |
485 syncable::ReadTransaction* transaction_; | 489 syncable::BaseTransaction* transaction_; |
| 490 bool close_transaction_; |
486 | 491 |
487 DISALLOW_COPY_AND_ASSIGN(ReadTransaction); | 492 DISALLOW_COPY_AND_ASSIGN(ReadTransaction); |
488 }; | 493 }; |
489 | 494 |
490 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps | 495 // Sync API's WriteTransaction is a read/write BaseTransaction. It wraps |
491 // a syncable::WriteTransaction. | 496 // a syncable::WriteTransaction. |
492 class WriteTransaction : public BaseTransaction { | 497 class WriteTransaction : public BaseTransaction { |
493 public: | 498 public: |
494 // Start a new read/write transaction. | 499 // Start a new read/write transaction. |
495 explicit WriteTransaction(UserShare* share); | 500 explicit WriteTransaction(UserShare* share); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 // This allows actual HttpPostProvider subclass implementations to be | 886 // This allows actual HttpPostProvider subclass implementations to be |
882 // reference counted, which is useful if a particular implementation uses | 887 // reference counted, which is useful if a particular implementation uses |
883 // multiple threads to serve network requests. | 888 // multiple threads to serve network requests. |
884 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 889 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
885 virtual ~HttpPostProviderFactory() { } | 890 virtual ~HttpPostProviderFactory() { } |
886 }; | 891 }; |
887 | 892 |
888 } // namespace sync_api | 893 } // namespace sync_api |
889 | 894 |
890 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 895 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |