Reland "WebNN: Handle WebNN context lost error"
This is a reland of commit a240af8bb2c11c08a6649388afdd4896818bf336
Included needed fix:
- Move calling
ID3D12Device::GetDeviceRemovedReason
before
callingWebNNContextImpl::OnLost
which will release the context to
avoid UAF forAdapter
. Because theAdapter
is referenced by
contexts, it will be released when all contexts are released. - Remove two invalid cases for
MLContext::writeBuffer
which will
callID3D12Device::CreateCommittedResource
on DirectML with size 0
to avoid crash.
Original change's description:
WebNN: Handle WebNN context lost error
This CL is to handle the WebNN context lost error and has implemented
for DirectML backend.
- Defined
MLContextLostInfo
dictionary in the WebIDL to expose the
context lost information.- Defined
Promise<MLContextLostInfo> lost
ofMLContext
interface
in the WebIDL, when the lost error is captured, the promise will be
resolved with theMLContextLostInfo
.- Defined
WebNNContextClient
mojom interface and it's method
OnLost(string message)
to send the context lost message to
the renderer process when theMLContext
object lost error in the
GPU process is captured. The renderer process will override this
method to handle the lost error.- Implemented the context lost handling feature in DirectML backend.
Bug: 40281640, 41492165
Change-Id: I16775ac8cdbd508e04025c22740d13f01e591b0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5602134
Reviewed-by: Reilly Grant reillyg@chromium.org
Reviewed-by: ningxin hu ningxin.hu@intel.com
Reviewed-by: Rafael Cintron rafael.cintron@microsoft.com
Commit-Queue: Mingming1 Xu mingming1.xu@intel.com
Cr-Commit-Position: refs/heads/main@{#1322573}
Bug: 40281640, 41492165
Change-Id: I3eaeb413c3c10e72416ab2932e182be3a01b99e0
Cq-Include-Trybots: luci.chromium.try:win11-blink-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5673825
Reviewed-by: Alex Gough ajgo@chromium.org
Reviewed-by: ningxin hu ningxin.hu@intel.com
Reviewed-by: Reilly Grant reillyg@chromium.org
Commit-Queue: Mingming1 Xu mingming1.xu@intel.com
Cr-Commit-Position: refs/heads/main@{#1324640}