• Derek Cheng's avatar
    [Media Router] Clean up MediaSinkServiceBase. · 064e46a2
    Derek Cheng authored
    MediaSinkServiceBase changes:
    
    - Move the Observer interface currently in CMSSImpl to
    MediaSinkServiceBase and generalizes it so it can be used for other
    MediaSinkServiceBase implementations.
    - Standardizes add/update/remove/get sink operations in
    MediaSinkServiceBase.
    Both of these make the code using MediaSinkServiceBase more testable as
    additional code in MRP depend on them.
    
    Also cleaned up logic related to the discovery timer by combining
    Start/RestartTimer().
    
    -----
    
    DialMediaSinkSevice changes:
    - DMSSImpl now pools sinks discovered in the latest round and is used
    to merge with the |MSSBase::sinks_| when the discovery timer fires.
    Before this patch, the current set is removed on the start of a discovery
    round (because unlike Cast, there is no active connection to a device to
    tell that it is still alive or gone), which makes the sink list unstable.
    With this patch, the current set is only modified at the end of a discovery
    round.
    - TODOs in future patches:
    -- move app discovery service out of DMSSImpl, similar to Cast.
    -- get rid of DMSS and move UI thread dependencies (if any) into part
       of DMSSImpl. Then rename DMSSImpl -> DMSS.
    
    -----
    
    CastMediaSinkService changes;
    - No longer keep track of sinks by ip endpoint. Instead uses
    |MSSBase::sinks_| to maintain sink list.
    - CastAppDiscoveryService no longer need to maintain its own map of
    sinks, and instead uses |MSSBase::GetSinks()/GetSinkById()|.
    - The callback used for dual disovery is converted to use
    MediaSinkServiceBase::Observer.
    - TODOs in future patches:
    -- get rid of CMSS and move UI thread dependencies into CMSSImpl.
    Rename CMSSImpl -> CMSS.
    -----
    
    Notes:
    - The MediaRouteDesktop ProvideSinks callback is not converted to use
    Observers. This is because the callback is expected to be temporary (until
    we can turn off the extension MRPs), so we treat it as a special case.
    
    Bug: 816628,698940
    Change-Id: I11fd13f7ebf743d78c9499ad24f98cf72f571ee5
    Reviewed-on: https://chromium-review.googlesource.com/1033727
    Commit-Queue: Derek Cheng <imcheng@chromium.org>
    Reviewed-by: default avatarBrandon Tolsch <btolsch@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#555854}
    064e46a2
test_helper.h 992 Bytes