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

Issue 2463843003: [Presentation API] Media Router: queue PresentationConnectionStateChanged events fired before callb… (Closed)

Created:
4 years, 1 month ago by zhaobin
Modified:
4 years, 1 month ago
Reviewers:
mark a. foltz, imcheng
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, feature-media-reviews_chromium.org, jam, haraken, media-router+watch_chromium.org, dglazkov+blink, darin-cc_chromium.org, mcasas+watch+vc_chromium.org, blink-reviews, blink-reviews-api_chromium.org, miu+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Reverted] We adopt a temporary workaround to signal state change in browser side (MR) [Presentation API] Media Router: queue PresentationConnectionStateChanged events fired before callback is registered. Sometimes ConnectionStateChanged event ('connecting'->'connected') is fired before we listening to connection state change. Those events are lost and onconnect event handler won't be called. We will queue those events and fire them later when callback becomes available. BUG=

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+99 lines, -12 lines) Patch
M chrome/browser/media/router/media_router_base.h View 4 chunks +10 lines, -1 line 0 comments Download
M chrome/browser/media/router/media_router_base.cc View 2 chunks +27 lines, -11 lines 1 comment Download
M chrome/browser/media/router/media_router_base_unittest.cc View 1 chunk +62 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 5 (3 generated)
zhaobin
4 years, 1 month ago (2016-11-01 01:56:58 UTC) #3
imcheng
4 years, 1 month ago (2016-11-01 20:09:19 UTC) #4
While I like the browser side queueing approach in theory since it is shared
with the Android implementation (though IIUC this has never been a problem on
Android), I have some concerns about managing the mapping browser-side. I am
wondering if they can be addressed here or if it's cleaner if we instead queue
on the extension side.

https://codereview.chromium.org/2463843003/diff/20001/chrome/browser/media/ro...
File chrome/browser/media/router/media_router_base.cc (right):

https://codereview.chromium.org/2463843003/diff/20001/chrome/browser/media/ro...
chrome/browser/media/router/media_router_base.cc:121:
queued_state_changes_.insert(std::make_pair(route_id, info));
If we never added a state change callback, would this end up staying in the map
indefinitely?

There are two issues we have to address here.

1) The extension can send us state change info with bogus route ids - in those
cases queued_state_changes_ will end up accumulating entries because we will
never add callbacks for them.

2) There are increased coupling between the behaviors of MR and Presentation API
implementation. Even for legit route IDs we expect a callback to be added at
some point in order for this to not be a (browser) memory leak.

I am wondering if there is a way to address these. Another approach I  think we
can consider is to have MR signal the extension that it is ready to receive
presentation connection state changes, similar to how it is done for messages.
This means queueing state changes in the extension and discarding them after
some condition is reached (for example, reaching a terminal state)

Powered by Google App Engine
This is Rietveld 408576698