Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: chrome/browser/media/router/mojo/media_router_mojo_impl.h

Issue 2735493002: MediaRouter: Cache MediaRoutesObserver queries to prevent ext wake-ups (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/mojo/media_router_mojo_impl.h
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl.h b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
index 73d7187e6f62bfb30c800eb0ea41bf29b462bd12..e088195007c824e312fa95b6b3e85f602cbfb85e 100644
--- a/chrome/browser/media/router/mojo/media_router_mojo_impl.h
+++ b/chrome/browser/media/router/mojo/media_router_mojo_impl.h
@@ -177,6 +177,7 @@ class MediaRouterMojoImpl : public MediaRouterBase,
// Empty otherwise.
std::vector<MediaSink> cached_sink_list;
std::vector<url::Origin> origins;
+
base::ObserverList<MediaSinksObserver> observers;
private:
@@ -190,6 +191,15 @@ class MediaRouterMojoImpl : public MediaRouterBase,
// True if the query has been sent to the MRPM. False otherwise.
bool is_active = false;
+
+ // True if cached result is available.
+ bool has_cached_result = false;
Wez 2017/03/04 02:07:32 nit: Since you have two cached-data fields below t
miu 2017/03/04 02:24:39 Done.
+
+ // Cached list of routes for the query, if |has_cached_result| is true.
+ // Empty otherwise.
+ std::vector<MediaRoute> cached_route_list;
+ std::vector<std::string> joinable_route_ids;
+
base::ObserverList<MediaRoutesObserver> observers;
private:
@@ -232,6 +242,11 @@ class MediaRouterMojoImpl : public MediaRouterBase,
void RegisterRouteMessageObserver(RouteMessageObserver* observer) override;
void UnregisterRouteMessageObserver(RouteMessageObserver* observer) override;
+ // Notifies |observer| of any existing cached routes, after registration.
+ void NotifyOfExistingRoutesAfterRegistration(
Wez 2017/03/04 02:07:32 This is a confusing name, IMO - I'd suggest either
miu 2017/03/04 02:24:39 Done.
+ const MediaSource::Id& source_id,
+ MediaRoutesObserver* observer) const;
+
// These calls invoke methods in the component extension via Mojo.
void DoCreateRoute(const MediaSource::Id& source_id,
const MediaSink::Id& sink_id,

Powered by Google App Engine
This is Rietveld 408576698