| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/download/download_query.h" | 5 #include "chrome/browser/download/download_query.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 template<> void DownloadQueryTest::AddFilter( | 128 template<> void DownloadQueryTest::AddFilter( |
| 129 DownloadQuery::FilterType name, const base::char16* cpp_value) { | 129 DownloadQuery::FilterType name, const base::char16* cpp_value) { |
| 130 CHECK(query_.AddFilter(name, base::StringValue(cpp_value))); | 130 CHECK(query_.AddFilter(name, base::StringValue(cpp_value))); |
| 131 } | 131 } |
| 132 | 132 |
| 133 template<> void DownloadQueryTest::AddFilter( | 133 template<> void DownloadQueryTest::AddFilter( |
| 134 DownloadQuery::FilterType name, std::vector<base::string16> cpp_value) { | 134 DownloadQuery::FilterType name, std::vector<base::string16> cpp_value) { |
| 135 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 135 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 136 for (std::vector<base::string16>::const_iterator it = cpp_value.begin(); | 136 for (std::vector<base::string16>::const_iterator it = cpp_value.begin(); |
| 137 it != cpp_value.end(); ++it) { | 137 it != cpp_value.end(); ++it) { |
| 138 list->Append(new base::StringValue(*it)); | 138 list->AppendString(*it); |
| 139 } | 139 } |
| 140 CHECK(query_.AddFilter(name, *list.get())); | 140 CHECK(query_.AddFilter(name, *list.get())); |
| 141 } | 141 } |
| 142 | 142 |
| 143 template<> void DownloadQueryTest::AddFilter( | 143 template<> void DownloadQueryTest::AddFilter( |
| 144 DownloadQuery::FilterType name, std::vector<std::string> cpp_value) { | 144 DownloadQuery::FilterType name, std::vector<std::string> cpp_value) { |
| 145 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 145 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 146 for (std::vector<std::string>::const_iterator it = cpp_value.begin(); | 146 for (std::vector<std::string>::const_iterator it = cpp_value.begin(); |
| 147 it != cpp_value.end(); ++it) { | 147 it != cpp_value.end(); ++it) { |
| 148 list->Append(new base::StringValue(*it)); | 148 list->AppendString(*it); |
| 149 } | 149 } |
| 150 CHECK(query_.AddFilter(name, *list.get())); | 150 CHECK(query_.AddFilter(name, *list.get())); |
| 151 } | 151 } |
| 152 | 152 |
| 153 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
| 154 template<> void DownloadQueryTest::AddFilter( | 154 template<> void DownloadQueryTest::AddFilter( |
| 155 DownloadQuery::FilterType name, std::wstring cpp_value) { | 155 DownloadQuery::FilterType name, std::wstring cpp_value) { |
| 156 CHECK(query_.AddFilter(name, base::StringValue(cpp_value))); | 156 CHECK(query_.AddFilter(name, base::StringValue(cpp_value))); |
| 157 } | 157 } |
| 158 #endif | 158 #endif |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 base::Time start = base::Time::Now(); | 610 base::Time start = base::Time::Now(); |
| 611 Search(); | 611 Search(); |
| 612 base::Time end = base::Time::Now(); | 612 base::Time end = base::Time::Now(); |
| 613 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; | 613 double nanos = (end - start).InMillisecondsF() * 1000.0 * 1000.0; |
| 614 double nanos_per_item = nanos / static_cast<double>(kNumItems); | 614 double nanos_per_item = nanos / static_cast<double>(kNumItems); |
| 615 double nanos_per_item_per_filter = nanos_per_item | 615 double nanos_per_item_per_filter = nanos_per_item |
| 616 / static_cast<double>(kNumFilters); | 616 / static_cast<double>(kNumFilters); |
| 617 std::cout << "Search took " << nanos_per_item_per_filter | 617 std::cout << "Search took " << nanos_per_item_per_filter |
| 618 << " nanoseconds per item per filter.\n"; | 618 << " nanoseconds per item per filter.\n"; |
| 619 } | 619 } |
| OLD | NEW |