Commit 6a54f464 authored by Shrek Shao's avatar Shrek Shao Committed by Commit Bot

GPUDevice and webgpu canvas context ukm metrics

New UKM metrics Request doc: go/client-rendering-api-ukm-review

A follow up of http://crrev.com/c/2473043

Adding UKM metrics collection for WebGPU canvas context and GPUDevice request

Bug: 1135706
Change-Id: I0432ad82f5f5a99c85d966ca3b8ff58a5be3cecd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2501069Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarAustin Eng <enga@chromium.org>
Commit-Queue: Shrek Shao <shrekshao@google.com>
Cr-Commit-Position: refs/heads/master@{#821577}
parent f8561ba1
......@@ -81,6 +81,7 @@ blink_modules_sources("webgpu") {
]
deps = [
"//gpu/command_buffer/client:webgpu_interface",
"//services/metrics/public/cpp:ukm_builders",
"//third_party/dawn/src/dawn:dawn_headers",
]
}
......@@ -7,4 +7,5 @@ include_rules = [
"+gpu/command_buffer/common/sync_token.h",
"+gpu/command_buffer/client/shared_image_interface.h",
"+gpu/command_buffer/client/webgpu_interface.h",
"+services/metrics/public/cpp/ukm_builders.h",
]
......@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/modules/webgpu/gpu_adapter.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_descriptor.h"
......@@ -67,6 +68,9 @@ void GPUAdapter::OnRequestDeviceCallback(ScriptPromiseResolver* resolver,
execution_context, GetDawnControlClient(), this, device_client_id,
descriptor);
resolver->Resolve(device);
ukm::builders::ClientRenderingAPI(execution_context->UkmSourceID())
.SetGPUDevice(static_cast<int>(true))
.Record(execution_context->UkmRecorder());
} else {
resolver->Reject(MakeGarbageCollected<DOMException>(
DOMExceptionCode::kOperationError,
......
......@@ -17,7 +17,12 @@ GPUCanvasContext::Factory::~Factory() {}
CanvasRenderingContext* GPUCanvasContext::Factory::Create(
CanvasRenderingContextHost* host,
const CanvasContextCreationAttributesCore& attrs) {
return MakeGarbageCollected<GPUCanvasContext>(host, attrs);
CanvasRenderingContext* rendering_context =
MakeGarbageCollected<GPUCanvasContext>(host, attrs);
DCHECK(host);
rendering_context->RecordUKMCanvasRenderingAPI(
CanvasRenderingContext::CanvasRenderingAPI::kWebgpu);
return rendering_context;
}
CanvasRenderingContext::ContextType GPUCanvasContext::Factory::GetContextType()
......
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