[AW] Bind once to metrics service in AwNonembeddedUmaRecorder
Make AwNonembeddedUmaRecorder bind once MetricsBridgeService and never unbind, i.e keep the service binding for the app context lifetime. This should save the overhead of binding and then unbinding for each histogram record. Never unbinding the service should be okay, while the non-embedded process is alive, there is expected to be a consistent stream of histogram records that need to be sent to the service. AwNonembeddedUmaRecorder can be accessed concurrently from many threads making it tricky to maintain one instance of ServiceConnection given possible accidental changes in connection status by the system. In order to avoid losing histogram records and not to block the calling thread, we add incoming histogram records to a thread-safe list and when the service connection is ready we send those records to the service. If the connection is ready we send records directly to the service. Fixed: 1081262 Test: bin/run_webview_instrumentation_test_apk -f "*AwNonembeddedUmaRecorderTest*" Change-Id: If61c6cdc25c61dacbbd747179e4625acf8a98a50 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2207531Reviewed-by:Richard Coles <torne@chromium.org> Reviewed-by:
Nate Fischer <ntfschr@chromium.org> Commit-Queue: Hazem Ashmawy <hazems@chromium.org> Cr-Commit-Position: refs/heads/master@{#772624}
Showing
Please register or sign in to comment