Commit 7ea6baaf authored by Alex Turner's avatar Alex Turner Committed by Commit Bot

Fix no binder error for UkmRecorderInterface on workers

Registers binders to allow UkmRecorderInterface to be used in worker
contexts. As these binders are not currently registered, calling
WorkerGlobalScope::UkmRecorder() causes a renderer crash. This can occur
when MediaSource::isTypeSupported() is called in a dedicated worker
context (with experimental web features enabled).

Bug: 1122971
Change-Id: If79cbd74cf7d88c66a9fc0eda820c60b682dc5a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424504Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809776}
parent 0bc27425
......@@ -65,6 +65,8 @@
#include "media/mojo/services/video_decode_perf_history.h"
#include "services/device/public/mojom/sensor_provider.mojom.h"
#include "services/device/public/mojom/vibration_manager.mojom.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "services/metrics/ukm_recorder_interface.h"
#include "services/network/public/cpp/cross_origin_embedder_policy.h"
#include "services/network/public/mojom/restricted_cookie_manager.mojom.h"
#include "services/shape_detection/public/mojom/barcodedetection_provider.mojom.h"
......@@ -203,6 +205,12 @@ void BindTextInputHost(
}
#endif
void BindUkmRecorderInterface(
mojo::PendingReceiver<ukm::mojom::UkmRecorderInterface> receiver) {
metrics::UkmRecorderInterface::Create(ukm::UkmRecorder::Get(),
std::move(receiver));
}
void BindBadgeServiceForServiceWorkerOnUI(
int service_worker_process_id,
const GURL& service_worker_scope,
......@@ -846,6 +854,8 @@ void PopulateDedicatedWorkerBinders(DedicatedWorkerHost* host,
base::BindRepeating(&BindFaceDetectionProvider));
map->Add<shape_detection::mojom::TextDetection>(
base::BindRepeating(&BindTextDetection));
map->Add<ukm::mojom::UkmRecorderInterface>(
base::BindRepeating(&BindUkmRecorderInterface));
// worker host binders
// base::Unretained(host) is safe because the map is owned by
......@@ -939,6 +949,8 @@ void PopulateSharedWorkerBinders(SharedWorkerHost* host, mojo::BinderMap* map) {
base::BindRepeating(&BindFaceDetectionProvider));
map->Add<shape_detection::mojom::TextDetection>(
base::BindRepeating(&BindTextDetection));
map->Add<ukm::mojom::UkmRecorderInterface>(
base::BindRepeating(&BindUkmRecorderInterface));
// worker host binders
// base::Unretained(host) is safe because the map is owned by
......@@ -1019,6 +1031,8 @@ void PopulateServiceWorkerBinders(ServiceWorkerHost* host,
base::BindRepeating(&BindFaceDetectionProvider));
map->Add<shape_detection::mojom::TextDetection>(
base::BindRepeating(&BindTextDetection));
map->Add<ukm::mojom::UkmRecorderInterface>(
base::BindRepeating(&BindUkmRecorderInterface));
// worker host binders
map->Add<blink::mojom::QuicTransportConnector>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment