summaryrefslogtreecommitdiffstats
path: root/sync/tools
diff options
context:
space:
mode:
authorpkasting <pkasting@chromium.org>2015-09-19 00:14:08 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-19 07:14:49 +0000
commit506d23f8515077d82f8621b143b6870ce6b55342 (patch)
tree099719061d2e46d0aa054f494a5ff726bf7db5d8 /sync/tools
parent91faaf5d738667ecb20c1fef481abcefd52ed6e6 (diff)
downloadchromium_src-506d23f8515077d82f8621b143b6870ce6b55342.zip
chromium_src-506d23f8515077d82f8621b143b6870ce6b55342.tar.gz
chromium_src-506d23f8515077d82f8621b143b6870ce6b55342.tar.bz2
Revert of Merge duplicate code in invalidation helper. (patchset #2 id:40001 of https://codereview.chromium.org/1310323009/ )
Reason for revert: Broke gn gen; see e.g. http://build.chromium.org/p/chromium.linux/builders/Linux%20Builder/builds/56707/steps/generate_build_files/logs/stdio Original issue's description: > Merge duplicate code in invalidation helper. > > There is code duplication in: > components/sync_driver/invalidation_helper > sync/tools/invalidation_helper > > This patch merged those files by removing duplicate code in > sync/tools/invalidation_helper. > > BUG=528259 > > Committed: https://crrev.com/de7123741b492a12f35a0cbd7b3e36ff3839a3e6 > Cr-Commit-Position: refs/heads/master@{#349849} TBR=droger@chromium.org,zea@chromium.org,jitendra.ks@samsung.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=528259 Review URL: https://codereview.chromium.org/1357143002 Cr-Commit-Position: refs/heads/master@{#349858}
Diffstat (limited to 'sync/tools')
-rw-r--r--sync/tools/BUILD.gn2
-rw-r--r--sync/tools/DEPS1
-rw-r--r--sync/tools/invalidation_helper.cc35
-rw-r--r--sync/tools/invalidation_helper.h21
-rw-r--r--sync/tools/sync_client.cc2
-rw-r--r--sync/tools/sync_listen_notifications.cc2
-rw-r--r--sync/tools/sync_tools.gyp4
7 files changed, 62 insertions, 5 deletions
diff --git a/sync/tools/BUILD.gn b/sync/tools/BUILD.gn
index 766803b..fc6f7ae 100644
--- a/sync/tools/BUILD.gn
+++ b/sync/tools/BUILD.gn
@@ -10,6 +10,8 @@ if (is_linux && !is_chromeos) {
testonly = true
sources = [
+ "invalidation_helper.cc",
+ "invalidation_helper.h",
"null_invalidation_state_tracker.cc",
"null_invalidation_state_tracker.h",
]
diff --git a/sync/tools/DEPS b/sync/tools/DEPS
index a7e3a39..b132cd2 100644
--- a/sync/tools/DEPS
+++ b/sync/tools/DEPS
@@ -1,6 +1,5 @@
include_rules = [
"+components/invalidation",
- "+components/sync_driver",
"+google/cacheinvalidation",
"+jingle/notifier/base",
"+net",
diff --git a/sync/tools/invalidation_helper.cc b/sync/tools/invalidation_helper.cc
new file mode 100644
index 0000000..61a4b87
--- /dev/null
+++ b/sync/tools/invalidation_helper.cc
@@ -0,0 +1,35 @@
+// Copyright 2014 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.
+
+#include "sync/tools/invalidation_helper.h"
+
+#include "google/cacheinvalidation/types.pb.h"
+
+namespace syncer {
+
+bool RealModelTypeToObjectId(ModelType model_type,
+ invalidation::ObjectId* object_id) {
+ std::string notification_type;
+ if (!RealModelTypeToNotificationType(model_type, &notification_type)) {
+ return false;
+ }
+ object_id->Init(ipc::invalidation::ObjectSource::CHROME_SYNC,
+ notification_type);
+ return true;
+}
+
+ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet model_types) {
+ ObjectIdSet ids;
+ for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) {
+ invalidation::ObjectId model_type_as_id;
+ if (!RealModelTypeToObjectId(it.Get(), &model_type_as_id)) {
+ DLOG(WARNING) << "Invalid model type " << it.Get();
+ continue;
+ }
+ ids.insert(model_type_as_id);
+ }
+ return ids;
+}
+
+} // namespace syncer
diff --git a/sync/tools/invalidation_helper.h b/sync/tools/invalidation_helper.h
new file mode 100644
index 0000000..c26c6ef
--- /dev/null
+++ b/sync/tools/invalidation_helper.h
@@ -0,0 +1,21 @@
+// Copyright 2014 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_TOOLS_INVALIDATION_HELPER_H_
+#define SYNC_TOOLS_INVALIDATION_HELPER_H_
+
+#include "components/invalidation/public/invalidation_util.h"
+#include "google/cacheinvalidation/include/types.h"
+#include "sync/internal_api/public/base/model_type.h"
+
+namespace syncer {
+
+bool RealModelTypeToObjectId(ModelType model_type,
+ invalidation::ObjectId* object_id);
+
+ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet model_types);
+
+}
+
+#endif // SYNC_TOOLS_INVALIDATION_HELPER_H
diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc
index d8653ec..d64041f 100644
--- a/sync/tools/sync_client.cc
+++ b/sync/tools/sync_client.cc
@@ -22,7 +22,6 @@
#include "base/threading/thread.h"
#include "components/invalidation/impl/non_blocking_invalidator.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
-#include "components/sync_driver/invalidation_helper.h"
#include "jingle/notifier/base/notification_method.h"
#include "jingle/notifier/base/notifier_options.h"
#include "net/base/host_port_pair.h"
@@ -45,6 +44,7 @@
#include "sync/js/js_event_details.h"
#include "sync/js/js_event_handler.h"
#include "sync/test/fake_encryptor.h"
+#include "sync/tools/invalidation_helper.h"
#include "sync/tools/null_invalidation_state_tracker.h"
#include "url/gurl.h"
diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc
index 1903f7f..3a1d808 100644
--- a/sync/tools/sync_listen_notifications.cc
+++ b/sync/tools/sync_listen_notifications.cc
@@ -21,7 +21,6 @@
#include "components/invalidation/public/invalidation_handler.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
-#include "components/sync_driver/invalidation_helper.h"
#include "jingle/notifier/base/notification_method.h"
#include "jingle/notifier/base/notifier_options.h"
#include "net/base/host_port_pair.h"
@@ -30,6 +29,7 @@
#include "net/http/transport_security_state.h"
#include "net/url_request/url_request_test_util.h"
#include "sync/internal_api/public/base/model_type.h"
+#include "sync/tools/invalidation_helper.h"
#include "sync/tools/null_invalidation_state_tracker.h"
#if defined(OS_MACOSX)
diff --git a/sync/tools/sync_tools.gyp b/sync/tools/sync_tools.gyp
index 49382a5..287178f 100644
--- a/sync/tools/sync_tools.gyp
+++ b/sync/tools/sync_tools.gyp
@@ -25,6 +25,8 @@
'../sync.gyp:sync',
],
'sources': [
+ 'invalidation_helper.cc',
+ 'invalidation_helper.h',
'null_invalidation_state_tracker.cc',
'null_invalidation_state_tracker.h',
],
@@ -40,7 +42,6 @@
'dependencies': [
'../../base/base.gyp:base',
'../../components/components.gyp:invalidation_impl',
- '../../components/components.gyp:sync_driver',
'../../jingle/jingle.gyp:notifier',
'../../net/net.gyp:net',
'../../net/net.gyp:net_test_support',
@@ -63,7 +64,6 @@
'dependencies': [
'../../base/base.gyp:base',
'../../components/components.gyp:invalidation_impl',
- '../../components/components.gyp:sync_driver',
'../../jingle/jingle.gyp:notifier',
'../../net/net.gyp:net',
'../../net/net.gyp:net_test_support',