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

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

Issue 6465005: [Sync] Initial support for encrypting any datatype (no UI hookup yet). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + small fix Created 9 years, 10 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/syncable/nigori_util_unittest.cc ('k') | chrome/browser/sync/util/cryptographer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/syncable/syncable.cc
diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc
index ac66083cc5f61a3b56fd3cb00697d9e30b78143e..7c0dcb481c680fc72342ec0baa25620c8389e67b 100644
--- a/chrome/browser/sync/syncable/syncable.cc
+++ b/chrome/browser/sync/syncable/syncable.cc
@@ -38,10 +38,6 @@
#include "base/time.h"
#include "chrome/browser/sync/engine/syncer.h"
#include "chrome/browser/sync/engine/syncer_util.h"
-#include "chrome/browser/sync/protocol/autofill_specifics.pb.h"
-#include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
-#include "chrome/browser/sync/protocol/password_specifics.pb.h"
-#include "chrome/browser/sync/protocol/preference_specifics.pb.h"
#include "chrome/browser/sync/protocol/service_constants.h"
#include "chrome/browser/sync/protocol/theme_specifics.pb.h"
#include "chrome/browser/sync/protocol/typed_url_specifics.pb.h"
@@ -227,7 +223,7 @@ void Directory::Kernel::Release() {
}
Directory::Kernel::~Kernel() {
- CHECK(0 == refcount);
+ CHECK_EQ(0, refcount);
delete channel;
changes_channel.Notify(kShutdownChangesEvent);
delete unsynced_metahandles;
@@ -490,14 +486,14 @@ void Directory::Delete(EntryKernel* const entry) {
entry->put(IS_DEL, true);
entry->mark_dirty(kernel_->dirty_metahandles);
ScopedKernelLock lock(this);
- CHECK(1 == kernel_->parent_id_child_index->erase(entry));
+ CHECK_EQ(1U, kernel_->parent_id_child_index->erase(entry));
}
bool Directory::ReindexId(EntryKernel* const entry, const Id& new_id) {
ScopedKernelLock lock(this);
if (NULL != GetEntryById(new_id, &lock))
return false;
- CHECK(1 == kernel_->ids_index->erase(entry));
+ CHECK_EQ(1U, kernel_->ids_index->erase(entry));
entry->put(ID, new_id);
CHECK(kernel_->ids_index->insert(entry).second);
return true;
@@ -505,7 +501,6 @@ bool Directory::ReindexId(EntryKernel* const entry, const Id& new_id) {
void Directory::ReindexParentId(EntryKernel* const entry,
const Id& new_parent_id) {
-
ScopedKernelLock lock(this);
if (entry->ref(IS_DEL)) {
entry->put(PARENT_ID, new_parent_id);
@@ -516,7 +511,7 @@ void Directory::ReindexParentId(EntryKernel* const entry,
return;
}
- CHECK(1 == kernel_->parent_id_child_index->erase(entry));
+ CHECK_EQ(1U, kernel_->parent_id_child_index->erase(entry));
entry->put(PARENT_ID, new_parent_id);
CHECK(kernel_->parent_id_child_index->insert(entry).second);
}
@@ -533,7 +528,7 @@ bool Directory::SafeToPurgeFromMemory(const EntryKernel* const entry) const {
if (safe) {
int64 handle = entry->ref(META_HANDLE);
- CHECK(kernel_->dirty_metahandles->count(handle) == 0);
+ CHECK_EQ(kernel_->dirty_metahandles->count(handle), 0U);
// TODO(tim): Bug 49278.
CHECK(!kernel_->unsynced_metahandles->count(handle));
CHECK(!kernel_->unapplied_update_metahandles->count(handle));
@@ -1001,7 +996,7 @@ void Directory::CheckTreeInvariants(syncable::BaseTransaction* trans,
CHECK(handles.end() != handles.find(parent.Get(META_HANDLE)))
<< e << parent;
parentid = parent.Get(PARENT_ID);
- CHECK(--safety_count >= 0) << e << parent;
+ CHECK_GE(--safety_count, 0) << e << parent;
}
}
int64 base_version = e.Get(BASE_VERSION);
@@ -1030,7 +1025,7 @@ void Directory::CheckTreeInvariants(syncable::BaseTransaction* trans,
// on the server, isn't waiting for application locally, but either
// is an unsynced create or a sucessful delete in the local copy.
// Either way, that's a mismatch.
- CHECK(0 == server_version) << e;
+ CHECK_EQ(0, server_version) << e;
// Items that aren't using the unique client tag should have a zero
// base version only if they have a local ID. Items with unique client
// tags are allowed to use the zero base version for undeletion and
@@ -1270,7 +1265,7 @@ syncable::ModelType Entry::GetServerModelType() const {
// It's possible we'll need to relax these checks in the future; they're
// just here for now as a safety measure.
DCHECK(Get(IS_UNSYNCED));
- DCHECK(Get(SERVER_VERSION) == 0);
+ DCHECK_EQ(Get(SERVER_VERSION), 0);
DCHECK(Get(SERVER_IS_DEL));
// Note: can't enforce !Get(ID).ServerKnows() here because that could
// actually happen if we hit AttemptReuniteLostCommitResponses.
@@ -1501,7 +1496,7 @@ bool MutableEntry::Put(IndexedBitField field, bool value) {
if (value)
CHECK(index->insert(kernel_->ref(META_HANDLE)).second);
else
- CHECK(1 == index->erase(kernel_->ref(META_HANDLE)));
+ CHECK_EQ(1U, index->erase(kernel_->ref(META_HANDLE)));
kernel_->put(field, value);
kernel_->mark_dirty(dir()->kernel_->dirty_metahandles);
}
« no previous file with comments | « chrome/browser/sync/syncable/nigori_util_unittest.cc ('k') | chrome/browser/sync/util/cryptographer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698