Title: [290827] trunk/Source/WebCore
- Revision
- 290827
- Author
- [email protected]
- Date
- 2022-03-04 04:01:21 -0800 (Fri, 04 Mar 2022)
Log Message
Iteration to search for least active WebGLRenderingContextBase could use min_element
https://bugs.webkit.org/show_bug.cgi?id=237464
Patch by Kimmo Kinnunen <[email protected]> on 2022-03-04
Reviewed by Antti Koivisto.
Apply review comments after landing bug 222411 r290816.
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::addActiveContext):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (290826 => 290827)
--- trunk/Source/WebCore/ChangeLog 2022-03-04 11:55:56 UTC (rev 290826)
+++ trunk/Source/WebCore/ChangeLog 2022-03-04 12:01:21 UTC (rev 290827)
@@ -1,3 +1,15 @@
+2022-03-04 Kimmo Kinnunen <[email protected]>
+
+ Iteration to search for least active WebGLRenderingContextBase could use min_element
+ https://bugs.webkit.org/show_bug.cgi?id=237464
+
+ Reviewed by Antti Koivisto.
+
+ Apply review comments after landing bug 222411 r290816.
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::addActiveContext):
+
2022-03-02 Antoine Quint <[email protected]>
[web-animations] keyframe values set to "inherit" should recompute their values when the inherited value changes
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (290826 => 290827)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-03-04 11:55:56 UTC (rev 290826)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2022-03-04 12:01:21 UTC (rev 290827)
@@ -809,12 +809,9 @@
auto& contexts = activeContexts();
auto maxContextsSize = isMainThread() ? maxActiveContexts : maxActiveWorkerContexts;
if (contexts.size() >= maxContextsSize) {
- auto it = contexts.begin();
- auto* earliest = *it;
- for (++it; it != contexts.end(); ++it) {
- if (earliest->activeOrdinal() > (*it)->activeOrdinal())
- earliest = *it;
- }
+ auto* earliest = *std::min_element(contexts.begin(), contexts.end(), [] (auto& a, auto& b) {
+ return a->activeOrdinal() < b->activeOrdinal();
+ });
earliest->recycleContext();
ASSERT(earliest != &newContext); // This assert is here so we can assert isNewEntry below instead of top-level `!contexts.contains(newContext);`.
ASSERT(contexts.size() < maxContextsSize);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes