summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorjitendra.ks <jitendra.ks@samsung.com>2015-09-21 08:32:08 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-21 15:32:48 +0000
commit61dd5d4b919569d5cda3bb100a41b20e9053b6ce (patch)
tree15d9ae34def80bbfbcdc42c05ac19daf11aa1679 /sync
parent2494736fa30ad7f8d5de1200d713c5b45fdfe225 (diff)
downloadchromium_src-61dd5d4b919569d5cda3bb100a41b20e9053b6ce.zip
chromium_src-61dd5d4b919569d5cda3bb100a41b20e9053b6ce.tar.gz
chromium_src-61dd5d4b919569d5cda3bb100a41b20e9053b6ce.tar.bz2
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} Review URL: https://codereview.chromium.org/1310323009 Cr-Commit-Position: refs/heads/master@{#349930}
Diffstat (limited to 'sync')
-rw-r--r--sync/tools/BUILD.gn5
-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, 8 insertions, 62 deletions
diff --git a/sync/tools/BUILD.gn b/sync/tools/BUILD.gn
index fc6f7ae..93c275f 100644
--- a/sync/tools/BUILD.gn
+++ b/sync/tools/BUILD.gn
@@ -10,8 +10,6 @@ if (is_linux && !is_chromeos) {
testonly = true
sources = [
- "invalidation_helper.cc",
- "invalidation_helper.h",
"null_invalidation_state_tracker.cc",
"null_invalidation_state_tracker.h",
]
@@ -19,6 +17,7 @@ if (is_linux && !is_chromeos) {
deps = [
"//base",
"//components/invalidation/impl",
+ "//components/sync_driver",
"//sync",
]
}
@@ -34,6 +33,7 @@ if (is_linux && !is_chromeos) {
":common",
"//base",
"//components/invalidation/impl",
+ "//components/sync_driver",
"//jingle:notifier",
"//net",
"//net:test_support",
@@ -53,6 +53,7 @@ if (is_linux && !is_chromeos) {
":common",
"//base",
"//components/invalidation/impl",
+ "//components/sync_driver",
"//jingle:notifier",
"//net",
"//net:test_support",
diff --git a/sync/tools/DEPS b/sync/tools/DEPS
index b132cd2..a7e3a39 100644
--- a/sync/tools/DEPS
+++ b/sync/tools/DEPS
@@ -1,5 +1,6 @@
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
deleted file mode 100644
index 61a4b87..0000000
--- a/sync/tools/invalidation_helper.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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
deleted file mode 100644
index c26c6ef..0000000
--- a/sync/tools/invalidation_helper.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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 d64041f..d8653ec 100644
--- a/sync/tools/sync_client.cc
+++ b/sync/tools/sync_client.cc
@@ -22,6 +22,7 @@
#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"
@@ -44,7 +45,6 @@
#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 3a1d808..1903f7f 100644
--- a/sync/tools/sync_listen_notifications.cc
+++ b/sync/tools/sync_listen_notifications.cc
@@ -21,6 +21,7 @@
#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"
@@ -29,7 +30,6 @@
#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 287178f..49382a5 100644
--- a/sync/tools/sync_tools.gyp
+++ b/sync/tools/sync_tools.gyp
@@ -25,8 +25,6 @@
'../sync.gyp:sync',
],
'sources': [
- 'invalidation_helper.cc',
- 'invalidation_helper.h',
'null_invalidation_state_tracker.cc',
'null_invalidation_state_tracker.h',
],
@@ -42,6 +40,7 @@
'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',
@@ -64,6 +63,7 @@
'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',