WebGL context count is not limited for GPU process Without GPU process, we have 20 context limit per web process. With GPU process, we don't have any limit. webgl/many-contexts-access-after-loss.html [ Failure ] webgl/max-active-contexts-console-warning.html [ Failure ] webgl/max-active-contexts-gc.html [ Failure ] webgl/max-active-contexts-oldest-context-lost.html [ Failure ] webgl/max-active-contexts-webglcontextlost-prevent-default.html [ Timeout ]
<rdar://problem/75025960>
Created attachment 453597 [details] Patch
Created attachment 453599 [details] Patch
Created attachment 453601 [details] Patch
Created attachment 453616 [details] Patch
Comment on attachment 453616 [details] Patch Looks great. r+
Created attachment 453714 [details] Patch
Created attachment 453716 [details] Patch for landing
*** Bug 236964 has been marked as a duplicate of this bug. ***
Comment on attachment 453714 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453714&action=review > Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:817 > + auto it = contexts.begin(); > + auto* earliest = *it; > + for (++it; it != contexts.end(); ++it) { > + if (earliest->activeOrdinal() > (*it)->activeOrdinal()) > + earliest = *it; > + } I might have written this with a modern for loop even though the loop is less tight: WebGLRenderingContextBase* earliest = nullptr; for (auto& context : contexts) { if (!earliest || earliest->activeOrdinal() > context.activeOrdinal()) earliest = &context; } Or using an algorithm: auto* earliest = *std::min_element(contexts.begin(), contexts.end(), [] (auto& a, auto& b) { return a.activeOrdinal() > b.activeOrdinal(); }); Or some day (not now): auto* earliest = std::ranges::min_element(contexts, [] (auto& a, auto& b) { return a.activeOrdinal() > b.activeOrdinal(); }); I may have the lambda backwards, not sure, so please don’t just paste.
Committed r290816 (248052@main): <https://commits.webkit.org/248052@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453716 [details].
(In reply to Darin Adler from comment #10) > Or using an algorithm: > > auto* earliest = *std::min_element(contexts.begin(), contexts.end(), [] > (auto& a, auto& b) { > return a.activeOrdinal() > b.activeOrdinal(); > }); > Thanks for the suggestion, bug 237464 tracks this.