Title: [275900] trunk
Revision
275900
Author
[email protected]
Date
2021-04-13 12:51:25 -0700 (Tue, 13 Apr 2021)

Log Message

Remove SharedBuffer's equality operators with Ref<SharedBuffer>
https://bugs.webkit.org/show_bug.cgi?id=224464

Patch by Alex Christensen <[email protected]> on 2021-04-13
Reviewed by Chris Dumez.

Source/WebCore:

No change in behavior.

I'm doing this to make a Ref comparator for all Refs to remove another reason we use RefPtr instead of Ref, even when they're all non-null.
See bug 224412

* platform/SharedBuffer.h:
(WebCore::operator==): Deleted.
(WebCore::operator!=): Deleted.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForKeyIDs const):
(WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):

Tools:

* TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275899 => 275900)


--- trunk/Source/WebCore/ChangeLog	2021-04-13 19:46:47 UTC (rev 275899)
+++ trunk/Source/WebCore/ChangeLog	2021-04-13 19:51:25 UTC (rev 275900)
@@ -1,3 +1,22 @@
+2021-04-13  Alex Christensen  <[email protected]>
+
+        Remove SharedBuffer's equality operators with Ref<SharedBuffer>
+        https://bugs.webkit.org/show_bug.cgi?id=224464
+
+        Reviewed by Chris Dumez.
+
+        No change in behavior.
+
+        I'm doing this to make a Ref comparator for all Refs to remove another reason we use RefPtr instead of Ref, even when they're all non-null.
+        See bug 224412
+
+        * platform/SharedBuffer.h:
+        (WebCore::operator==): Deleted.
+        (WebCore::operator!=): Deleted.
+        * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+        (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionForKeyIDs const):
+        (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
+
 2021-04-13  Kimmo Kinnunen  <[email protected]>
 
         AudioSourceProviderAVFObjC should check for m_client when dispatching setFormat

Modified: trunk/Source/WebCore/platform/SharedBuffer.h (275899 => 275900)


--- trunk/Source/WebCore/platform/SharedBuffer.h	2021-04-13 19:46:47 UTC (rev 275899)
+++ trunk/Source/WebCore/platform/SharedBuffer.h	2021-04-13 19:51:25 UTC (rev 275900)
@@ -230,16 +230,6 @@
 #endif
 };
 
-inline bool operator==(const Ref<SharedBuffer>& left, const SharedBuffer& right)
-{
-    return left.get() == right;
-}
-
-inline bool operator!=(const Ref<SharedBuffer>& left, const SharedBuffer& right)
-{
-    return left.get() != right;
-}
-
 class WEBCORE_EXPORT SharedBufferDataView {
 public:
     SharedBufferDataView(Ref<SharedBuffer::DataSegment>&&, size_t);

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (275899 => 275900)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2021-04-13 19:46:47 UTC (rev 275899)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm	2021-04-13 19:51:25 UTC (rev 275900)
@@ -585,10 +585,12 @@
             continue;
 
         auto sessionKeys = sessionInterface->keyIDs();
-        if (anyOf(sessionKeys, [&](auto& sessionKey) {
-            return keyIDs.contains(sessionKey);
+        if (anyOf(sessionKeys, [&](const Ref<SharedBuffer>& sessionKey) {
+            return keyIDs.findMatching([&](const Ref<SharedBuffer>& keyID) {
+                return keyID.get() == sessionKey.get();
+            }) != notFound;
         }))
-            return sessionInterface.get();
+        return sessionInterface.get();
     }
     return nullptr;
 }
@@ -854,7 +856,9 @@
             auto keyID = SharedBuffer::create(WTFMove(keyIDVector));
             auto foundIndex = m_currentRequest.value().requests.findMatching([&] (auto& request) {
                 auto keyIDs = keyIDsForRequest(request.get());
-                return keyIDs.contains(keyID);
+                return keyIDs.findMatching([&](const Ref<SharedBuffer>& id) {
+                    return id.get() == keyID.get();
+                }) != notFound;
             });
             if (foundIndex == notFound)
                 return false;

Modified: trunk/Tools/ChangeLog (275899 => 275900)


--- trunk/Tools/ChangeLog	2021-04-13 19:46:47 UTC (rev 275899)
+++ trunk/Tools/ChangeLog	2021-04-13 19:51:25 UTC (rev 275900)
@@ -1,3 +1,13 @@
+2021-04-13  Alex Christensen  <[email protected]>
+
+        Remove SharedBuffer's equality operators with Ref<SharedBuffer>
+        https://bugs.webkit.org/show_bug.cgi?id=224464
+
+        Reviewed by Chris Dumez.
+
+        * TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
+        (TestWebKitAPI::TEST_F):
+
 2021-04-13  Devin Rousso  <[email protected]>
 
         [iOS] Only use the theme color if it's valid when `UseThemeColorForScrollAreaBackgroundColor` is enabled

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp (275899 => 275900)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp	2021-04-13 19:46:47 UTC (rev 275899)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp	2021-04-13 19:51:25 UTC (rev 275900)
@@ -207,14 +207,14 @@
         return buffer;
     };
     auto buffer1 = makeBuffer({{'a', 'b', 'c', 'd'}});
-    EXPECT_EQ(buffer1, buffer1);
+    EXPECT_EQ(buffer1.get(), buffer1.get());
 
     buffer1->append(Vector<char>({'a', 'b', 'c', 'd'}));
-    EXPECT_EQ(buffer1, makeBuffer({{'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd'}}));
-    EXPECT_EQ(makeBuffer({{'a'}, {'b', 'c'}, {'d'}}), makeBuffer({{'a', 'b'}, {'c', 'd'}}));
-    EXPECT_NE(makeBuffer({{'a', 'b'}}), makeBuffer({{'a', 'b', 'c'}}));
-    EXPECT_NE(makeBuffer({{'a', 'b'}}), makeBuffer({{'b', 'c'}}));
-    EXPECT_NE(makeBuffer({{'a'}, {'b'}}), makeBuffer({{'a'}, {'a'}}));
+    EXPECT_EQ(buffer1.get(), makeBuffer({{'a', 'b', 'c', 'd', 'a', 'b', 'c', 'd'}}).get());
+    EXPECT_EQ(makeBuffer({{'a'}, {'b', 'c'}, {'d'}}).get(), makeBuffer({{'a', 'b'}, {'c', 'd'}}).get());
+    EXPECT_NE(makeBuffer({{'a', 'b'}}).get(), makeBuffer({{'a', 'b', 'c'}}).get());
+    EXPECT_NE(makeBuffer({{'a', 'b'}}).get(), makeBuffer({{'b', 'c'}}).get());
+    EXPECT_NE(makeBuffer({{'a'}, {'b'}}).get(), makeBuffer({{'a'}, {'a'}}).get());
 }
 
 TEST_F(SharedBufferTest, toHexString)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to