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

Unified Diff: third_party/libaddressinput/chromium/trie.cc

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitelist strings used on all platforms. Created 6 years, 6 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: third_party/libaddressinput/chromium/trie.cc
diff --git a/third_party/libaddressinput/chromium/cpp/src/util/trie.cc b/third_party/libaddressinput/chromium/trie.cc
similarity index 72%
copy from third_party/libaddressinput/chromium/cpp/src/util/trie.cc
copy to third_party/libaddressinput/chromium/trie.cc
index 07fb8776e4cc06263b46aaec9a79f3c13bad21db..ad55bc12d21aaf034c3e9ca4fd5897410243bb77 100644
--- a/third_party/libaddressinput/chromium/cpp/src/util/trie.cc
+++ b/third_party/libaddressinput/chromium/trie.cc
@@ -1,20 +1,9 @@
-// Copyright (C) 2014 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// 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 "trie.h"
+#include "third_party/libaddressinput/chromium/trie.h"
-#include <cassert>
#include <cstddef>
#include <map>
#include <queue>
@@ -22,10 +11,18 @@
#include <string>
#include <utility>
-#include "stl_util.h"
+#include "base/logging.h"
+#include "base/stl_util.h"
+// Separating template definitions and declarations requires defining all
+// possible template parameters to avoid linking errors.
namespace i18n {
namespace addressinput {
+class RegionData;
+}
+}
+
+namespace autofill {
template <typename T>
Trie<T>::Trie() {}
@@ -46,7 +43,7 @@ void Trie<T>::AddDataForKey(const std::string& key, const T& data_item) {
std::make_pair(key[key_start], new Trie<T>)).first;
}
current_node = sub_node_it->second;
- assert(current_node != NULL);
+ DCHECK(current_node);
}
current_node->data_list_.push_back(data_item);
}
@@ -54,7 +51,7 @@ void Trie<T>::AddDataForKey(const std::string& key, const T& data_item) {
template <typename T>
void Trie<T>::FindDataForKeyPrefix(const std::string& key_prefix,
std::set<T>* results) const {
- assert(results != NULL);
+ DCHECK(results);
// Find the sub-trie for the key prefix.
const Trie<T>* current_node = this;
@@ -66,7 +63,7 @@ void Trie<T>::FindDataForKeyPrefix(const std::string& key_prefix,
return;
}
current_node = sub_node_it->second;
- assert(current_node != NULL);
+ DCHECK(current_node);
}
// Collect data from all sub-tries.
@@ -88,11 +85,7 @@ void Trie<T>::FindDataForKeyPrefix(const std::string& key_prefix,
}
}
-// Separating template definitions and declarations requires defining all
-// possible template parameters to avoid linking errors.
-class Ruleset;
-template class Trie<const Ruleset*>;
+template class Trie<const ::i18n::addressinput::RegionData*>;
template class Trie<std::string>;
-} // namespace addressinput
-} // namespace i18n
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698