[Video capture service] Improve delayed service quit logic
The video capture service shuts down when not in use. The current logic triggers a 5 second timer when the last client disconnects. When the timer expires, it either stays alive if there now is a client connect or it shuts down if there still is no client connected. This logic is not very suitable for usage patterns where clients may connect frequently but only for very brief periods of time. If that happens, the service may end up shutting down and starting back up again frequently. This CL changes the logic such that when a new client connects, any previous timers are cancelled. Also part of this CL: * Move tests that are concerned with verifying when the service does or does not quit closer to the implementation. This allows eliminating the need for dynamically configuring a timeout for testing, and instead looking for ref counts. Bug: 829581 Test: services_unittests --gtest_filter=DeviceFactoryProviderConnectorTest.* Change-Id: I788775aaf6e77159a9142994d4772200ab42a14d Reviewed-on: https://chromium-review.googlesource.com/1089921Reviewed-by:Tom Sepez <tsepez@chromium.org> Reviewed-by:
Ken Rockot <rockot@chromium.org> Commit-Queue: Christian Fremerey <chfremer@chromium.org> Cr-Commit-Position: refs/heads/master@{#569666}
Showing
Please register or sign in to comment