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

Unified Diff: sync/android/java/src/org/chromium/sync/notifier/InvalidationClientNameProvider.java

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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
Index: sync/android/java/src/org/chromium/sync/notifier/InvalidationClientNameProvider.java
diff --git a/sync/android/java/src/org/chromium/sync/notifier/InvalidationClientNameProvider.java b/sync/android/java/src/org/chromium/sync/notifier/InvalidationClientNameProvider.java
deleted file mode 100644
index 73915b9c01b642bbd267c9890cb407f761140197..0000000000000000000000000000000000000000
--- a/sync/android/java/src/org/chromium/sync/notifier/InvalidationClientNameProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2013 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.
-
-package org.chromium.sync.notifier;
-
-/**
- * An injectable singleton that provides an invalidation client with an appropriate unique name.
- *
- * This singleton will always provide a somewhat reasonable name. With proper support from outside
- * components, it will be able to provide a name that is consistent across restarts.
- */
-public class InvalidationClientNameProvider {
- private static final Object LOCK = new Object();
-
- private static InvalidationClientNameProvider sInstance;
-
- private final Object mLock;
-
- private InvalidationClientNameGenerator mGenerator;
-
- private byte[] mUniqueId;
-
- public static InvalidationClientNameProvider get() {
- synchronized (LOCK) {
- if (sInstance == null) {
- sInstance = new InvalidationClientNameProvider();
- }
- return sInstance;
- }
- }
-
- InvalidationClientNameProvider() {
- mLock = new Object();
- mGenerator = new RandomizedInvalidationClientNameGenerator();
- }
-
- /** Returns a consistent unique string of bytes for use as an invalidator client ID. */
- public byte[] getInvalidatorClientName() {
- synchronized (mLock) {
- if (mUniqueId == null) {
- mUniqueId = mGenerator.generateInvalidatorClientName();
- }
- return mUniqueId;
- }
- }
-
- public void setPreferredClientNameGenerator(InvalidationClientNameGenerator generator) {
- mGenerator = generator;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698