diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 22:54:19 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 22:54:19 +0000 |
commit | 69b3b8f04b759b700b78987fd74cd16c081e6d0e (patch) | |
tree | 03942e40523cfc328b66d77186e0d1552c19beb9 /sync/engine/syncer_util.cc | |
parent | c09eeea393004f61f55adca9aeda4aa387cee903 (diff) | |
download | chromium_src-69b3b8f04b759b700b78987fd74cd16c081e6d0e.zip chromium_src-69b3b8f04b759b700b78987fd74cd16c081e6d0e.tar.gz chromium_src-69b3b8f04b759b700b78987fd74cd16c081e6d0e.tar.bz2 |
[Sync] Refactor GetEncryptedTypes usage.
The cryptographer is now owned by the SyncEncryptionHandlerImpl, and
no longer needs any connection to the nigori handler or encrypted types.
Those are accessed via the directory, which now has a GetNigoriHandler
method.
Because of this, we can now clean up the thread safety guarantees in the
sync encryption handler impl, enforcing that everything except
GetEncryptedTypes (and IsUsingExplicitPassphrase, which will be fixed in a
followup patch) are invoked on the syncer thread. This lets us not have to
open unnecessary transactions.
At the chrome layer, encrypted types are accessed via BaseTransaction::
GetEncryptedTypes(). At the syncer layer, they're accessed via directory::
GetNigoriHandler()->GetEncryptedTypes(BaseTransaction* trans const).
BUG=142476,139848
Review URL: https://chromiumcodereview.appspot.com/10844005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine/syncer_util.cc')
-rw-r--r-- | sync/engine/syncer_util.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sync/engine/syncer_util.cc b/sync/engine/syncer_util.cc index ca21f2e..8a243df 100644 --- a/sync/engine/syncer_util.cc +++ b/sync/engine/syncer_util.cc @@ -22,6 +22,7 @@ #include "sync/syncable/directory.h" #include "sync/syncable/entry.h" #include "sync/syncable/mutable_entry.h" +#include "sync/syncable/nigori_handler.h" #include "sync/syncable/nigori_util.h" #include "sync/syncable/read_transaction.h" #include "sync/syncable/syncable_changes_version.h" @@ -217,7 +218,7 @@ UpdateAttemptResponse AttemptToUpdateEntry( // the nigori node (e.g. on restart), they will commit without issue. if (specifics.has_nigori()) { const sync_pb::NigoriSpecifics& nigori = specifics.nigori(); - cryptographer->ApplyNigoriUpdate(nigori, trans); + trans->directory()->GetNigoriHandler()->ApplyNigoriUpdate(nigori, trans); // Make sure any unsynced changes are properly encrypted as necessary. // We only perform this if the cryptographer is ready. If not, these are @@ -235,7 +236,7 @@ UpdateAttemptResponse AttemptToUpdateEntry( // If this fails, something is wrong with the cryptographer, but there's // nothing we can do about it here. DVLOG(1) << "Received new nigori, encrypting unsynced changes."; - syncable::ProcessUnsyncedChangesForEncryption(trans, cryptographer); + syncable::ProcessUnsyncedChangesForEncryption(trans); } } |