| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/memory/shared_memory.h" | |
| 12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 13 #include "base/test/perf_log.h" | 12 #include "base/test/perf_log.h" |
| 14 #include "base/test/perf_time_logger.h" | 13 #include "base/test/perf_time_logger.h" |
| 15 #include "base/test/test_file_util.h" | 14 #include "base/test/test_file_util.h" |
| 16 #include "base/timer/elapsed_timer.h" | 15 #include "base/timer/elapsed_timer.h" |
| 17 #include "components/visitedlink/browser/visitedlink_master.h" | 16 #include "components/visitedlink/browser/visitedlink_master.h" |
| 18 #include "content/public/test/test_browser_thread_bundle.h" | 17 #include "content/public/test/test_browser_thread_bundle.h" |
| 19 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 | 33 |
| 35 // Returns a URL with the given prefix and index | 34 // Returns a URL with the given prefix and index |
| 36 GURL TestURL(const char* prefix, int i) { | 35 GURL TestURL(const char* prefix, int i) { |
| 37 return GURL(base::StringPrintf("%s%d", prefix, i)); | 36 return GURL(base::StringPrintf("%s%d", prefix, i)); |
| 38 } | 37 } |
| 39 | 38 |
| 40 // We have no slaves, so all methods on this listener are a no-ops. | 39 // We have no slaves, so all methods on this listener are a no-ops. |
| 41 class DummyVisitedLinkEventListener : public VisitedLinkMaster::Listener { | 40 class DummyVisitedLinkEventListener : public VisitedLinkMaster::Listener { |
| 42 public: | 41 public: |
| 43 DummyVisitedLinkEventListener() {} | 42 DummyVisitedLinkEventListener() {} |
| 44 void NewTable(base::SharedMemory* table) override {} | 43 void NewTable(mojo::SharedBufferHandle) override {} |
| 45 void Add(VisitedLinkCommon::Fingerprint) override {} | 44 void Add(VisitedLinkCommon::Fingerprint) override {} |
| 46 void Reset(bool invalidate_hashes) override {} | 45 void Reset(bool invalidate_hashes) override {} |
| 47 }; | 46 }; |
| 48 | 47 |
| 49 | 48 |
| 50 // this checks IsVisited for the URLs starting with the given prefix and | 49 // this checks IsVisited for the URLs starting with the given prefix and |
| 51 // within the given range | 50 // within the given range |
| 52 void CheckVisited(VisitedLinkMaster& master, const char* prefix, | 51 void CheckVisited(VisitedLinkMaster& master, const char* prefix, |
| 53 int begin, int end) { | 52 int begin, int end) { |
| 54 for (int i = begin; i < end; i++) | 53 for (int i = begin; i < end; i++) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 cold_sum += cold_load_times[i]; | 196 cold_sum += cold_load_times[i]; |
| 198 hot_sum += hot_load_times[i]; | 197 hot_sum += hot_load_times[i]; |
| 199 } | 198 } |
| 200 base::LogPerfResult( | 199 base::LogPerfResult( |
| 201 "Visited_link_cold_load_time", cold_sum / cold_load_times.size(), "ms"); | 200 "Visited_link_cold_load_time", cold_sum / cold_load_times.size(), "ms"); |
| 202 base::LogPerfResult( | 201 base::LogPerfResult( |
| 203 "Visited_link_hot_load_time", hot_sum / hot_load_times.size(), "ms"); | 202 "Visited_link_hot_load_time", hot_sum / hot_load_times.size(), "ms"); |
| 204 } | 203 } |
| 205 | 204 |
| 206 } // namespace visitedlink | 205 } // namespace visitedlink |
| OLD | NEW |