Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3211)

Unified Diff: chrome/browser/sync/internal_api/base_transaction.h

Issue 7624009: Original patch by rlarocque@chromium.org at http://codereview.chromium.org/7633077/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build pt5 Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/internal_api/base_node.cc ('k') | chrome/browser/sync/internal_api/base_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/internal_api/base_transaction.h
diff --git a/chrome/browser/sync/internal_api/base_transaction.h b/chrome/browser/sync/internal_api/base_transaction.h
new file mode 100644
index 0000000000000000000000000000000000000000..9bf2fb36be80feb271c156052f65b1c76ed43c0e
--- /dev/null
+++ b/chrome/browser/sync/internal_api/base_transaction.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SYNC_INTERNAL_API_BASE_TRANSACTION_H_
+#define CHROME_BROWSER_SYNC_INTERNAL_API_BASE_TRANSACTION_H_
+#pragma once
+
+#include "chrome/browser/sync/internal_api/user_share.h"
+
+#include "chrome/browser/sync/util/cryptographer.h"
+
+namespace syncable {
+class BaseTransaction;
+class ScopedDirLookup;
+}
+
+namespace sync_api {
+
+// Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for
+// batching of several read and/or write operations. The read and write
+// operations are performed by creating ReadNode and WriteNode instances using
+// the transaction. These transaction classes wrap identically named classes in
+// syncable, and are used in a similar way. Unlike syncable::BaseTransaction,
+// whose construction requires an explicit syncable::ScopedDirLookup, a sync
+// API BaseTransaction creates its own ScopedDirLookup implicitly.
+class BaseTransaction {
+ public:
+ // Provide access to the underlying syncable.h objects from BaseNode.
+ virtual syncable::BaseTransaction* GetWrappedTrans() const = 0;
+ const syncable::ScopedDirLookup& GetLookup() const { return *lookup_; }
+ browser_sync::Cryptographer* GetCryptographer() const {
+ return cryptographer_;
+ }
+
+ protected:
+ // The ScopedDirLookup is created in the constructor and destroyed
+ // in the destructor. Creation of the ScopedDirLookup is not expected
+ // to fail.
+ explicit BaseTransaction(UserShare* share);
+ virtual ~BaseTransaction();
+
+ BaseTransaction() { lookup_= NULL; }
+
+ private:
+ // A syncable ScopedDirLookup, which is the parent of syncable transactions.
+ syncable::ScopedDirLookup* lookup_;
+
+ browser_sync::Cryptographer* cryptographer_;
+
+ DISALLOW_COPY_AND_ASSIGN(BaseTransaction);
+};
+
+syncable::ModelTypeSet GetEncryptedTypes(
+ const sync_api::BaseTransaction* trans);
+
+} // namespace sync_api
+
+#endif // CHROME_BROWSER_SYNC_INTERNAL_API_BASE_TRANSACTION_H_
« no previous file with comments | « chrome/browser/sync/internal_api/base_node.cc ('k') | chrome/browser/sync/internal_api/base_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698