Chromium Code Reviews| 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 73% |
| rename from third_party/libaddressinput/chromium/cpp/src/util/trie.cc |
| rename to third_party/libaddressinput/chromium/trie.cc |
| index 07fb8776e4cc06263b46aaec9a79f3c13bad21db..a23ab47ed39c7b531003194ae2c16ea1f67a3ca6 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 addressinput |
| +} // namespace i18n |
|
please use gerrit instead
2014/06/05 22:22:49
No need for closing namespace comment on a forward
please use gerrit instead
2014/06/09 23:28:17
Done.
|
| + |
| +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 |