diff options
author | maniscalco <maniscalco@chromium.org> | 2015-04-17 11:24:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-17 18:24:46 +0000 |
commit | fbc37dbb7d825716d66b5d79bc07c8272db155e3 (patch) | |
tree | 1201922d9222fcfead81f0e32fc886285b0d7c52 /sync | |
parent | 803ed45377abd56203f9627a27ff52cf5d414240 (diff) | |
download | chromium_src-fbc37dbb7d825716d66b5d79bc07c8272db155e3.zip chromium_src-fbc37dbb7d825716d66b5d79bc07c8272db155e3.tar.gz chromium_src-fbc37dbb7d825716d66b5d79bc07c8272db155e3.tar.bz2 |
[Sync] Delete syncable::Blob and associated dead code
BUG=477706
Review URL: https://codereview.chromium.org/1095593002
Cr-Commit-Position: refs/heads/master@{#325682}
Diffstat (limited to 'sync')
-rw-r--r-- | sync/BUILD.gn | 1 | ||||
-rw-r--r-- | sync/engine/syncer_proto_util.cc | 22 | ||||
-rw-r--r-- | sync/engine/syncer_proto_util.h | 10 | ||||
-rw-r--r-- | sync/engine/syncer_proto_util_unittest.cc | 56 | ||||
-rw-r--r-- | sync/engine/syncer_unittest.cc | 1 | ||||
-rw-r--r-- | sync/sync.gyp | 1 | ||||
-rw-r--r-- | sync/syncable/blob.h | 20 | ||||
-rw-r--r-- | sync/syncable/entry.cc | 8 |
8 files changed, 0 insertions, 119 deletions
diff --git a/sync/BUILD.gn b/sync/BUILD.gn index 9a95bb1..1ce80b1 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn @@ -316,7 +316,6 @@ source_set("sync_core") { "sessions/sync_session.h", "sessions/sync_session_context.cc", "sessions/sync_session_context.h", - "syncable/blob.h", "syncable/deferred_on_disk_directory_backing_store.cc", "syncable/deferred_on_disk_directory_backing_store.h", "syncable/dir_open_result.h", diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc index c28d7c2..b21525c 100644 --- a/sync/engine/syncer_proto_util.cc +++ b/sync/engine/syncer_proto_util.cc @@ -522,28 +522,6 @@ bool SyncerProtoUtil::ShouldMaintainPosition( } // static -void SyncerProtoUtil::CopyProtoBytesIntoBlob(const std::string& proto_bytes, - syncable::Blob* blob) { - syncable::Blob proto_blob(proto_bytes.begin(), proto_bytes.end()); - blob->swap(proto_blob); -} - -// static -bool SyncerProtoUtil::ProtoBytesEqualsBlob(const std::string& proto_bytes, - const syncable::Blob& blob) { - if (proto_bytes.size() != blob.size()) - return false; - return std::equal(proto_bytes.begin(), proto_bytes.end(), blob.begin()); -} - -// static -void SyncerProtoUtil::CopyBlobIntoProtoBytes(const syncable::Blob& blob, - std::string* proto_bytes) { - std::string blob_string(blob.begin(), blob.end()); - proto_bytes->swap(blob_string); -} - -// static const std::string& SyncerProtoUtil::NameFromSyncEntity( const sync_pb::SyncEntity& entry) { if (entry.has_non_unique_name()) diff --git a/sync/engine/syncer_proto_util.h b/sync/engine/syncer_proto_util.h index 604fbc6..d58189a 100644 --- a/sync/engine/syncer_proto_util.h +++ b/sync/engine/syncer_proto_util.h @@ -13,7 +13,6 @@ #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/util/syncer_error.h" #include "sync/sessions/sync_session.h" -#include "sync/syncable/blob.h" namespace sync_pb { class ClientToServerMessage; @@ -61,15 +60,6 @@ class SYNC_EXPORT_PRIVATE SyncerProtoUtil { static bool ShouldMaintainPosition(const sync_pb::SyncEntity& sync_entity); - // Utility methods for converting between syncable::Blobs and protobuf byte - // fields. - static void CopyProtoBytesIntoBlob(const std::string& proto_bytes, - syncable::Blob* blob); - static bool ProtoBytesEqualsBlob(const std::string& proto_bytes, - const syncable::Blob& blob); - static void CopyBlobIntoProtoBytes(const syncable::Blob& blob, - std::string* proto_bytes); - // Extract the name field from a sync entity. static const std::string& NameFromSyncEntity( const sync_pb::SyncEntity& entry); diff --git a/sync/engine/syncer_proto_util_unittest.cc b/sync/engine/syncer_proto_util_unittest.cc index a5c1fd4..35cc2c7 100644 --- a/sync/engine/syncer_proto_util_unittest.cc +++ b/sync/engine/syncer_proto_util_unittest.cc @@ -17,7 +17,6 @@ #include "sync/protocol/sync.pb.h" #include "sync/protocol/sync_enums.pb.h" #include "sync/sessions/sync_session_context.h" -#include "sync/syncable/blob.h" #include "sync/syncable/directory.h" #include "sync/test/engine/mock_connection_manager.h" #include "sync/test/engine/test_directory_setter_upper.h" @@ -32,7 +31,6 @@ using sync_pb::SyncEntity; namespace syncer { using sessions::SyncSessionContext; -using syncable::Blob; class MockDelegate : public sessions::SyncSession::Delegate { public: @@ -78,60 +76,6 @@ TEST(SyncerProtoUtil, ConvertErrorPBToLocalType) { ModelTypeSet(BOOKMARKS, HISTORY_DELETE_DIRECTIVES))); } -TEST(SyncerProtoUtil, TestBlobToProtocolBufferBytesUtilityFunctions) { - unsigned char test_data1[] = {1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 4, 2, 9}; - unsigned char test_data2[] = {1, 99, 3, 4, 5, 6, 7, 8, 0, 1, 4, 2, 9}; - unsigned char test_data3[] = {99, 2, 3, 4, 5, 6, 7, 8}; - - syncable::Blob test_blob1, test_blob2, test_blob3; - for (size_t i = 0; i < arraysize(test_data1); ++i) - test_blob1.push_back(test_data1[i]); - for (size_t i = 0; i < arraysize(test_data2); ++i) - test_blob2.push_back(test_data2[i]); - for (size_t i = 0; i < arraysize(test_data3); ++i) - test_blob3.push_back(test_data3[i]); - - std::string test_message1(reinterpret_cast<char*>(test_data1), - arraysize(test_data1)); - std::string test_message2(reinterpret_cast<char*>(test_data2), - arraysize(test_data2)); - std::string test_message3(reinterpret_cast<char*>(test_data3), - arraysize(test_data3)); - - EXPECT_TRUE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message1, - test_blob1)); - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message1, - test_blob2)); - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message1, - test_blob3)); - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message2, - test_blob1)); - EXPECT_TRUE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message2, - test_blob2)); - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message2, - test_blob3)); - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message3, - test_blob1)); - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message3, - test_blob2)); - EXPECT_TRUE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message3, - test_blob3)); - - Blob blob1_copy; - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message1, - blob1_copy)); - SyncerProtoUtil::CopyProtoBytesIntoBlob(test_message1, &blob1_copy); - EXPECT_TRUE(SyncerProtoUtil::ProtoBytesEqualsBlob(test_message1, - blob1_copy)); - - std::string message2_copy; - EXPECT_FALSE(SyncerProtoUtil::ProtoBytesEqualsBlob(message2_copy, - test_blob2)); - SyncerProtoUtil::CopyBlobIntoProtoBytes(test_blob2, &message2_copy); - EXPECT_TRUE(SyncerProtoUtil::ProtoBytesEqualsBlob(message2_copy, - test_blob2)); -} - // Tests NameFromSyncEntity and NameFromCommitEntryResponse when only the name // field is provided. TEST(SyncerProtoUtil, NameExtractionOneName) { diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc index dd20b5e..3257c4b 100644 --- a/sync/engine/syncer_unittest.cc +++ b/sync/engine/syncer_unittest.cc @@ -72,7 +72,6 @@ using std::vector; namespace syncer { using syncable::BaseTransaction; -using syncable::Blob; using syncable::CountEntriesWithName; using syncable::Directory; using syncable::Entry; diff --git a/sync/sync.gyp b/sync/sync.gyp index 89e96ce..0151223 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp @@ -369,7 +369,6 @@ 'sessions/sync_session.h', 'sessions/sync_session_context.cc', 'sessions/sync_session_context.h', - 'syncable/blob.h', 'syncable/deferred_on_disk_directory_backing_store.cc', 'syncable/deferred_on_disk_directory_backing_store.h', 'syncable/dir_open_result.h', diff --git a/sync/syncable/blob.h b/sync/syncable/blob.h deleted file mode 100644 index 0f68a24..0000000 --- a/sync/syncable/blob.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2012 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 SYNC_SYNCABLE_BLOB_H_ -#define SYNC_SYNCABLE_BLOB_H_ - -#include <vector> - -#include "base/basictypes.h" // For uint8. - -namespace syncer { -namespace syncable { - -typedef std::vector<uint8> Blob; - -} // namespace syncable -} // namespace syncer - -#endif // SYNC_SYNCABLE_BLOB_H_ diff --git a/sync/syncable/entry.cc b/sync/syncable/entry.cc index 9c6f862..e9d4ec1 100644 --- a/sync/syncable/entry.cc +++ b/sync/syncable/entry.cc @@ -8,7 +8,6 @@ #include "base/json/string_escape.h" #include "base/strings/string_util.h" -#include "sync/syncable/blob.h" #include "sync/syncable/directory.h" #include "sync/syncable/syncable_base_transaction.h" #include "sync/syncable/syncable_columns.h" @@ -135,13 +134,6 @@ bool Entry::ShouldMaintainHierarchy() const { return kernel_->ShouldMaintainHierarchy(); } -std::ostream& operator<<(std::ostream& s, const Blob& blob) { - for (Blob::const_iterator i = blob.begin(); i != blob.end(); ++i) - s << std::hex << std::setw(2) - << std::setfill('0') << static_cast<unsigned int>(*i); - return s << std::dec; -} - std::ostream& operator<<(std::ostream& os, const Entry& entry) { int i; EntryKernel* const kernel = entry.kernel_; |