|
|
Chromium Code Reviews|
Created:
4 years, 4 months ago by apacible Modified:
4 years, 4 months ago Reviewers:
imcheng CC:
chromium-reviews, media-router+watch_chromium.org, arv+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Description[Media Router WebUI] Append new sinks to the end of the list.
Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink.
This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list.
Also updated variable naming to make it more easily readable.
BUG=634365
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Committed: https://crrev.com/e23faebb13dc082e283a8e53d460a7cb8625aabd
Cr-Commit-Position: refs/heads/master@{#410585}
Patch Set 1 #
Total comments: 11
Patch Set 2 : Changes per imcheng@'s comments. #
Messages
Total messages: 35 (25 generated)
Description was changed from ========== asdf BUG= ========== to ========== asdf BUG= CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
The CQ bit was checked by apacible@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== asdf BUG= CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Description was changed from ========== asdf BUG= CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_...) chromeos_x86-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-ge...)
The CQ bit was checked by apacible@chromium.org to run a CQ dry run
Patchset #1 (id:1) has been deleted
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. Also updated variable naming to make it more easily readable. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-...)
The CQ bit was checked by apacible@chromium.org to run a CQ dry run
Patchset #1 (id:20001) has been deleted
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
apacible@chromium.org changed reviewers: + imcheng@chromium.org
PTAL, thanks! I plan merge this back to M53 before OOO, so would like to get this change in by Tuesday EOD.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_...) chromeos_x86-generic_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_x86-ge...)
As discussed, since we are no longer maintaining order by sink name, we should just remove the sorting logic in the C++ code. https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... File chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js (right): https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2024: // dialog, which can surprise users / lead to inadvertent casting to the nit: inadvertently https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2029: for (var j = 0; j < updatedSinkList.length; j++) { You can probably write L2028-L2041 as: var index = this.sinksToShow_.findIndex(updatedSink => { return this.sinksToShow_[i].id == updatedSink.id; }); if (index < 0) { this.sinksToShow_.splice(i, 1); } else { updatedSinkList.splice(j, 1); } https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2044: updatedSinkList = this.sinksToShow_.concat(updatedSinkList); this.sinksToShow_.add(...updatedSinkList); and no need reassign this.sinksToShow_ in this case.
https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... File chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js (right): https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2044: updatedSinkList = this.sinksToShow_.concat(updatedSinkList); On 2016/08/09 02:29:09, imcheng wrote: > this.sinksToShow_.add(...updatedSinkList); and no need reassign > this.sinksToShow_ in this case. s/add/push
The CQ bit was checked by apacible@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
> As discussed, since we are no longer maintaining order by sink name, we should > just remove the sorting logic in the C++ code. After thinking about it a bit more, I think it makes sense to keep the sorting logic in the C++ side. After initial discovery, opening the dialog should give us most, if not all, of the available sinks. It would be nice to maintain an order. WDYT? https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... File chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js (right): https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2024: // dialog, which can surprise users / lead to inadvertent casting to the On 2016/08/09 02:29:09, imcheng wrote: > nit: inadvertently Done. https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2029: for (var j = 0; j < updatedSinkList.length; j++) { On 2016/08/09 02:29:09, imcheng wrote: > You can probably write L2028-L2041 as: > > var index = this.sinksToShow_.findIndex(updatedSink => { return > this.sinksToShow_[i].id == updatedSink.id; }); > if (index < 0) { > this.sinksToShow_.splice(i, 1); > } else { > updatedSinkList.splice(j, 1); > } Done (with minor tweaks). https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2044: updatedSinkList = this.sinksToShow_.concat(updatedSinkList); On 2016/08/09 02:29:55, imcheng wrote: > On 2016/08/09 02:29:09, imcheng wrote: > > this.sinksToShow_.add(...updatedSinkList); and no need reassign > > this.sinksToShow_ in this case. > > s/add/push Kept as concat() as push() takes items individually as parameters. Reassigning this.sinksToShow_() explicitly also triggers the observer function.
On 2016/08/09 04:02:39, apacible wrote: > > As discussed, since we are no longer maintaining order by sink name, we should > > just remove the sorting logic in the C++ code. > > After thinking about it a bit more, I think it makes sense to keep the sorting > logic in the C++ side. After initial discovery, opening the dialog should give > us most, if not all, of the available sinks. It would be nice to maintain an > order. WDYT? That may or may not be true depending on the user's machine and network conditions. IMO it makes more sense for it to be either always sorted, or no sorting at all. I feel the user may be confused by the almost-sorted behavior. Another way to address this would be to ignore clicks for a short period right after the list is updated (say 100ms). Just a thought. But I will defer to UX's judgment on this. > > https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... > File > chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js > (right): > > https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... > chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2024: > // dialog, which can surprise users / lead to inadvertent casting to the > On 2016/08/09 02:29:09, imcheng wrote: > > nit: inadvertently > > Done. > > https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... > chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2029: > for (var j = 0; j < updatedSinkList.length; j++) { > On 2016/08/09 02:29:09, imcheng wrote: > > You can probably write L2028-L2041 as: > > > > var index = this.sinksToShow_.findIndex(updatedSink => { return > > this.sinksToShow_[i].id == updatedSink.id; }); > > if (index < 0) { > > this.sinksToShow_.splice(i, 1); > > } else { > > updatedSinkList.splice(j, 1); > > } > > Done (with minor tweaks). > > https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... > chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2044: > updatedSinkList = this.sinksToShow_.concat(updatedSinkList); > On 2016/08/09 02:29:55, imcheng wrote: > > On 2016/08/09 02:29:09, imcheng wrote: > > > this.sinksToShow_.add(...updatedSinkList); and no need reassign > > > this.sinksToShow_ in this case. > > > > s/add/push > > Kept as concat() as push() takes items individually as parameters. Reassigning > this.sinksToShow_() explicitly also triggers the observer function.
lgtm after comments addressed https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... File chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js (right): https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2029: for (var j = 0; j < updatedSinkList.length; j++) { On 2016/08/09 04:02:39, apacible wrote: > On 2016/08/09 02:29:09, imcheng wrote: > > You can probably write L2028-L2041 as: > > > > var index = this.sinksToShow_.findIndex(updatedSink => { return > > this.sinksToShow_[i].id == updatedSink.id; }); > > if (index < 0) { > > this.sinksToShow_.splice(i, 1); > > } else { > > updatedSinkList.splice(j, 1); > > } > > Done (with minor tweaks). Cool. What is the reason for not using the arrow function? ES6 should be supported by now? https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2044: updatedSinkList = this.sinksToShow_.concat(updatedSinkList); On 2016/08/09 04:02:39, apacible wrote: > On 2016/08/09 02:29:55, imcheng wrote: > > On 2016/08/09 02:29:09, imcheng wrote: > > > this.sinksToShow_.add(...updatedSinkList); and no need reassign > > > this.sinksToShow_ in this case. > > > > s/add/push > > Kept as concat() as push() takes items individually as parameters. Reassigning > this.sinksToShow_() explicitly also triggers the observer function. Okay since we need to trigger observer function. By the way, the spread operator "..." will convert an iterable object into individual items: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/S...
https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... File chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js (right): https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2029: for (var j = 0; j < updatedSinkList.length; j++) { On 2016/08/09 04:31:26, imcheng wrote: > On 2016/08/09 04:02:39, apacible wrote: > > On 2016/08/09 02:29:09, imcheng wrote: > > > You can probably write L2028-L2041 as: > > > > > > var index = this.sinksToShow_.findIndex(updatedSink => { return > > > this.sinksToShow_[i].id == updatedSink.id; }); > > > if (index < 0) { > > > this.sinksToShow_.splice(i, 1); > > > } else { > > > updatedSinkList.splice(j, 1); > > > } > > > > Done (with minor tweaks). > > Cool. What is the reason for not using the arrow function? ES6 should be > supported by now? Presubmit complained about it when I tried to upload the patch. I also didn't find other usages of the arrow function under c/b/r. https://codereview.chromium.org/2221933003/diff/40001/chrome/browser/resource... chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js:2044: updatedSinkList = this.sinksToShow_.concat(updatedSinkList); On 2016/08/09 04:31:26, imcheng wrote: > On 2016/08/09 04:02:39, apacible wrote: > > On 2016/08/09 02:29:55, imcheng wrote: > > > On 2016/08/09 02:29:09, imcheng wrote: > > > > this.sinksToShow_.add(...updatedSinkList); and no need reassign > > > > this.sinksToShow_ in this case. > > > > > > s/add/push > > > > Kept as concat() as push() takes items individually as parameters. Reassigning > > this.sinksToShow_() explicitly also triggers the observer function. > > Okay since we need to trigger observer function. By the way, the spread operator > "..." will convert an iterable object into individual items: > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/S... Acknowledged, thanks!
The CQ bit was unchecked by apacible@chromium.org
The CQ bit was checked by apacible@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. Also updated variable naming to make it more easily readable. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. Also updated variable naming to make it more easily readable. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
Message was sent while issue was closed.
Committed patchset #2 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. Also updated variable naming to make it more easily readable. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== [Media Router WebUI] Append new sinks to the end of the list. Currently, when the sink list is updated in the WebUI, we just replace |sinksToShow_| in the container. This sometimes causes re-sorting and sinks suddenly appear in a different place. This can result in accidental casting to the wrong sink. This change appends new sinks to the end of the sink list. A user who has incrementally discovered sinks will see the dialog grow vertically as new sinks are appended at the bottom of the list. Also updated variable naming to make it more easily readable. BUG=634365 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/e23faebb13dc082e283a8e53d460a7cb8625aabd Cr-Commit-Position: refs/heads/master@{#410585} ==========
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/e23faebb13dc082e283a8e53d460a7cb8625aabd Cr-Commit-Position: refs/heads/master@{#410585} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
