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

Unified Diff: chrome/browser/sync/syncable/syncable.h

Issue 2805095: Fix deadlock by introducing a new transaction event. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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
Index: chrome/browser/sync/syncable/syncable.h
diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h
index 3793a2cbde592cc08d68715cadf17f0fd9ea603d..291e7983e8c3db1faef70068230c40b3d9b69bf7 100644
--- a/chrome/browser/sync/syncable/syncable.h
+++ b/chrome/browser/sync/syncable/syncable.h
@@ -586,6 +586,10 @@ struct DirectoryChangeEvent {
// callbacks or attempt to lock anything because a
// WriteTransaction is being held until the listener returns.
CALCULATE_CHANGES,
+ // Means the WriteTransaction is ending, and this is the absolute
+ // last chance to perform any read operations in the current transaction.
+ // It is not recommended that the listener perform any writes.
+ TRANSACTION_ENDING,
// Means the WriteTransaction has been released and the listener
// can now take action on the changes it calculated.
TRANSACTION_COMPLETE,
@@ -594,7 +598,7 @@ struct DirectoryChangeEvent {
} todo;
// These members are only valid for CALCULATE_CHANGES.
const OriginalEntries* originals;
- BaseTransaction* trans;
+ BaseTransaction* trans; // This is valid also for TRANSACTION_ENDING
WriterTag writer;
typedef DirectoryChangeEvent EventType;
static inline bool IsChannelShutdownEvent(const EventType& e) {
@@ -1044,6 +1048,8 @@ class BaseTransaction {
inline Directory* directory() const { return directory_; }
inline Id root_id() const { return Id(); }
+ virtual ~BaseTransaction();
+
protected:
BaseTransaction(Directory* directory, const char* name,
const char* source_file, int line, WriterTag writer);
@@ -1072,7 +1078,7 @@ class ReadTransaction : public BaseTransaction {
ReadTransaction(const ScopedDirLookup& scoped_dir,
const char* source_file, int line);
- ~ReadTransaction();
+ virtual ~ReadTransaction();
protected: // Don't allow creation on heap, except by sync API wrapper.
friend class sync_api::ReadTransaction;

Powered by Google App Engine
This is Rietveld 408576698