[CrOS Tether] Convert HostScanCache to an interface and add MasterHostScanCache as the concrete implementation

Desktop / Chromium - Kyle Horimoto [google.com] - 12 July 2017 17:46 EDT

This CL also creates a HostScanCacheEntry class which encapsulates data to be stored in the cache as well as adding a Builder pattern which makes creating cache entries easier. This will make it much easier to add new properties to the host scan cache without having to add new parameters to every affected function prototype.

This is the first step of persisting host scan results so that we can recover from crashes. Steps listed below: (1 - this CL) Create a HostScanCache interface and move the concrete implementation to MasterHostScanCache. (2) Create a HostScanCache implementation which persists cache entries to user prefs. (3) Move code which adds entries in the network stack to another HostScanCache implementation, and have MasterHostScanCache manage the other two HostScanCache implementations.

Bug: 672263, 737273 Change-Id: I42646de50d393e9b327371effbf974020083b12d Reviewed-on: https://chromium-review.googlesource.com/567235 Commit-Queue: Kyle Horimoto

a451dfe [CrOS Tether] Convert HostScanCache to an interface and add MasterHostScanCache as the concrete implementation.
chromeos/components/tether/BUILD.gn | 7 +-
chromeos/components/tether/fake_host_scan_cache.cc | 58 ++-------
chromeos/components/tether/fake_host_scan_cache.h | 22 +---
chromeos/components/tether/host_scan_cache.h | 105 +++------------
.../components/tether/host_scan_cache_entry.cc | 86 +++++++++++++
chromeos/components/tether/host_scan_cache_entry.h | 80 ++++++++++++
chromeos/components/tether/host_scanner.cc | 18 ++-
.../components/tether/host_scanner_unittest.cc | 32 ++---
chromeos/components/tether/initializer.cc | 4 +-
chromeos/components/tether/keep_alive_scheduler.cc | 19 ++-
.../tether/keep_alive_scheduler_unittest.cc | 7 +-
...ost_scan_cache.cc => master_host_scan_cache.cc} | 72 +++++------
.../components/tether/master_host_scan_cache.h | 96 ++++++++++++++
...ttest.cc => master_host_scan_cache_unittest.cc} | 141 +++++++++------------
.../components/tether/tether_connector_unittest.cc | 12 +-
.../tether/tether_host_response_recorder.h | 2 +-
16 files changed, 453 insertions(+), 308 deletions(-)

Upstream: git.chromium.org


  • Share