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

Issue 2824883005: [Mojo Video Capture] Stop service when last client disconnects. (Closed)

Created:
3 years, 8 months ago by chfremer
Modified:
3 years, 7 months ago
CC:
Aaron Boodman, abarth-chromium, chfremer+watch_chromium.org, chromium-reviews, darin (slow to review), feature-media-reviews_chromium.org, miu+watch_chromium.org, posciak+watch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, xjz+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Mojo Video Capture] Stop service when last client disconnects. This CL is part of the Mojo Video Capture work. For the bigger picture, see [1] CL23. Purpose of this CL: Stop service when last client disconnects. Once we host it in a separate process, this will allow the service to automatically restart when a new request comes in. Changes in this CL: * Split class video_capture::ServiceImpl into two classes ServiceManagerServiceImpl and VideoCaptureServiceImpl. * In class ServiceManagerServiceImpl, following the example of ImageDecoder [2], use a ServiceContextRefFactory to manage service lifetime and implement a delayed service shutdown when there are no clients. * Add tests ServiceQuitsWhenNoClientConnected and ServiceQuitsWhenClientDisconnectsWhileUsingDevice * In service.mojom, add a method for setting the service shutdown delay. For the automated tests, set the delay to zero. * In DeviceFactoryMediaToMojoAdapter, make sure that |capture_system_->GetDeviceInfosAsync()| is called before |capture_system_->CreateDevice()|. This is required by the implementation VideoCaptureSystemImpl in order to fill the cache |devices_info_cache_|. * In DeviceMediaToMojoAdapter, unsubscibe from |receiver.set_connection_error_handler()| in order to avoid use after free on service shutdown. * In ReceiverMojoToMediaAdapter, introduce class ReceiverOnTaskRunner in order to ensure that mojom.Receiver methods are posted to the correct thread. * In VideoCaptureDeviceClient, allow |external_jpeg_decoder_| to be nullptr, since in the context of the video_capture service, this will (for now) be the case. BUG=584797 TEST= service_unittests --gtest_filter="*Video*" content_unittests --gtest_filter="*Video*" content_browsertests --gtest_filter="VideoCaptureBrowserTest.*" [1] https://docs.google.com/a/chromium.org/document/d/1Qw7rw1AJy0QHXjha36jZNiEuxsxWslJ_X-zpOhijvI8/edit?usp=sharing [2] https://cs.chromium.org/chromium/src/services/data_decoder/data_decoder_service.cc?dr=CSs Review-Url: https://codereview.chromium.org/2824883005 Cr-Commit-Position: refs/heads/master@{#468358} Committed: https://chromium.googlesource.com/chromium/src/+/9fe5b74189b804423d7fe66182a3c07dd6c61dd1

Patch Set 1 #

Total comments: 38

Patch Set 2 : Incorporate suggestions from PatchSet 1 #

Total comments: 6

Patch Set 3 : Rebase to Apr 27th #

Patch Set 4 : Incorporate suggestions from PatchSet #2 #

Total comments: 12

Patch Set 5 : Incorporate suggestions from PatchSet #4 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+519 lines, -333 lines) Patch
M media/capture/video/video_capture_device_client.cc View 1 chunk +2 lines, -1 line 0 comments Download
M media/capture/video/video_capture_system.h View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M services/video_capture/BUILD.gn View 1 5 chunks +15 lines, -9 lines 0 comments Download
M services/video_capture/device_factory_media_to_mojo_adapter.h View 1 3 chunks +12 lines, -1 line 0 comments Download
M services/video_capture/device_factory_media_to_mojo_adapter.cc View 1 5 chunks +33 lines, -3 lines 0 comments Download
A + services/video_capture/device_factory_provider_impl.h View 1 2 3 1 chunk +18 lines, -24 lines 0 comments Download
A + services/video_capture/device_factory_provider_impl.cc View 1 3 chunks +25 lines, -28 lines 0 comments Download
M services/video_capture/device_media_to_mojo_adapter.h View 1 2 chunks +13 lines, -5 lines 0 comments Download
M services/video_capture/device_media_to_mojo_adapter.cc View 1 2 chunks +26 lines, -7 lines 0 comments Download
A services/video_capture/public/cpp/BUILD.gn View 1 1 chunk +24 lines, -0 lines 0 comments Download
M services/video_capture/public/interfaces/BUILD.gn View 1 2 chunks +7 lines, -1 line 0 comments Download
A services/video_capture/public/interfaces/constants.mojom View 1 1 chunk +8 lines, -0 lines 0 comments Download
A + services/video_capture/public/interfaces/device_factory_provider.mojom View 1 2 chunks +9 lines, -2 lines 0 comments Download
M services/video_capture/public/interfaces/service.mojom View 1 1 chunk +0 lines, -20 lines 0 comments Download
M services/video_capture/receiver_mojo_to_media_adapter.h View 1 2 chunks +32 lines, -1 line 0 comments Download
M services/video_capture/receiver_mojo_to_media_adapter.cc View 1 chunk +69 lines, -0 lines 0 comments Download
D services/video_capture/service_impl.h View 1 2 3 4 2 chunks +20 lines, -26 lines 0 comments Download
D services/video_capture/service_impl.cc View 1 2 3 4 1 chunk +52 lines, -57 lines 0 comments Download
A + services/video_capture/test/device_factory_provider_test.h View 1 2 3 1 chunk +40 lines, -8 lines 0 comments Download
A services/video_capture/test/device_factory_provider_test.cc View 1 1 chunk +43 lines, -0 lines 0 comments Download
A + services/video_capture/test/device_factory_provider_unittest.cc View 1 5 chunks +28 lines, -5 lines 0 comments Download
M services/video_capture/test/fake_device_descriptor_test.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M services/video_capture/test/fake_device_descriptor_test.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M services/video_capture/test/fake_device_unittest.cc View 1 2 chunks +23 lines, -0 lines 0 comments Download
M services/video_capture/test/mock_device_factory.h View 1 1 chunk +1 line, -1 line 0 comments Download
M services/video_capture/test/mock_device_test.h View 1 3 chunks +5 lines, -3 lines 0 comments Download
M services/video_capture/test/mock_device_test.cc View 1 4 chunks +6 lines, -4 lines 0 comments Download
M services/video_capture/test/service_test.h View 1 1 chunk +0 lines, -32 lines 0 comments Download
M services/video_capture/test/service_test.cc View 1 1 chunk +0 lines, -20 lines 0 comments Download
M services/video_capture/test/service_unittest.cc View 1 1 chunk +0 lines, -70 lines 0 comments Download
M services/video_capture/test/service_unittest_manifest.json View 1 chunk +2 lines, -1 line 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 43 (29 generated)
chfremer
rockot@: PTAL emircan@: PTAL mcasas@: FYI miu@: FYI
3 years, 8 months ago (2017-04-19 23:22:12 UTC) #10
Ken Rockot(use gerrit already)
All Mojo and Service Manager stuff (e.g. usage of ServiceContextRef) LGTM https://codereview.chromium.org/2824883005/diff/20001/services/video_capture/service_manager_service_impl.h File services/video_capture/service_manager_service_impl.h (right): ...
3 years, 8 months ago (2017-04-26 19:40:20 UTC) #14
chfremer
https://codereview.chromium.org/2824883005/diff/20001/services/video_capture/service_manager_service_impl.h File services/video_capture/service_manager_service_impl.h (right): https://codereview.chromium.org/2824883005/diff/20001/services/video_capture/service_manager_service_impl.h#newcode19 services/video_capture/service_manager_service_impl.h:19: class ServiceManagerServiceImpl : public service_manager::Service { On 2017/04/26 19:40:19, ...
3 years, 8 months ago (2017-04-26 20:01:54 UTC) #15
Ken Rockot(use gerrit already)
I see. I think it's probably confusing to have a video_capture::Service interface. I realize that ...
3 years, 8 months ago (2017-04-26 20:05:48 UTC) #16
mcasas
Please try to keep CLs smaller (e.g. leave renames or class-splitting for separate CLs etc) ...
3 years, 8 months ago (2017-04-26 22:12:32 UTC) #17
chfremer
PTAL Apologies for the repeatedly large review. Will work harder to keep them more reasonable. ...
3 years, 8 months ago (2017-04-26 23:33:36 UTC) #20
mcasas
https://codereview.chromium.org/2824883005/diff/40001/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h File services/video_capture/public/cpp/device_to_feedback_observer_adapter.h (right): https://codereview.chromium.org/2824883005/diff/40001/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h#newcode25 services/video_capture/public/cpp/device_to_feedback_observer_adapter.h:25: mojom::DevicePtr* device_; I'm surprised by this change, it seems ...
3 years, 8 months ago (2017-04-27 00:22:16 UTC) #23
chfremer
mcasas@: PTAL https://codereview.chromium.org/2824883005/diff/40001/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h File services/video_capture/public/cpp/device_to_feedback_observer_adapter.h (right): https://codereview.chromium.org/2824883005/diff/40001/services/video_capture/public/cpp/device_to_feedback_observer_adapter.h#newcode25 services/video_capture/public/cpp/device_to_feedback_observer_adapter.h:25: mojom::DevicePtr* device_; On 2017/04/27 00:22:15, mcasas wrote: ...
3 years, 7 months ago (2017-04-27 19:52:50 UTC) #26
mcasas
my parts LGTM w/ some comments. https://codereview.chromium.org/2824883005/diff/80001/media/capture/video/video_capture_system.h File media/capture/video/video_capture_system.h (right): https://codereview.chromium.org/2824883005/diff/80001/media/capture/video/video_capture_system.h#newcode14 media/capture/video/video_capture_system.h:14: // CreateDevice(). nit: ...
3 years, 7 months ago (2017-04-27 20:10:02 UTC) #27
chfremer
Thanks for the review! https://codereview.chromium.org/2824883005/diff/80001/media/capture/video/video_capture_system.h File media/capture/video/video_capture_system.h (right): https://codereview.chromium.org/2824883005/diff/80001/media/capture/video/video_capture_system.h#newcode14 media/capture/video/video_capture_system.h:14: // CreateDevice(). On 2017/04/27 20:10:02, ...
3 years, 7 months ago (2017-04-27 23:48:14 UTC) #30
chfremer
tsepez@: Please RS *.mojom
3 years, 7 months ago (2017-04-28 16:45:14 UTC) #34
Tom Sepez
RS LGTM Stampity Stamp.
3 years, 7 months ago (2017-04-28 16:48:49 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2824883005/100001
3 years, 7 months ago (2017-05-01 16:28:12 UTC) #40
commit-bot: I haz the power
3 years, 7 months ago (2017-05-01 18:24:30 UTC) #43
Message was sent while issue was closed.
Committed patchset #5 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/9fe5b74189b804423d7fe66182a3...

Powered by Google App Engine
This is Rietveld 408576698