Title: [248183] trunk/Source/WTF
Revision
248183
Author
[email protected]
Date
2019-08-02 14:54:26 -0700 (Fri, 02 Aug 2019)

Log Message

uniqueLogIdentifier() should generate a 64-bit identifier
https://bugs.webkit.org/show_bug.cgi?id=200403
<rdar://problem/53878447>

Reviewed by Youenn Fablet.

* wtf/LoggerHelper.h:
(WTF::LoggerHelper::childLogIdentifier const): Use uint64_t masks.
(WTF::LoggerHelper::uniqueLogIdentifier): cryptographicallyRandomNumber returns a
uint32_t so use two to generate a 64-bit identifier.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (248182 => 248183)


--- trunk/Source/WTF/ChangeLog	2019-08-02 21:32:09 UTC (rev 248182)
+++ trunk/Source/WTF/ChangeLog	2019-08-02 21:54:26 UTC (rev 248183)
@@ -1,3 +1,16 @@
+2019-08-02  Eric Carlson  <[email protected]>
+
+        uniqueLogIdentifier() should generate a 64-bit identifier
+        https://bugs.webkit.org/show_bug.cgi?id=200403
+        <rdar://problem/53878447>
+
+        Reviewed by Youenn Fablet.
+
+        * wtf/LoggerHelper.h:
+        (WTF::LoggerHelper::childLogIdentifier const): Use uint64_t masks.
+        (WTF::LoggerHelper::uniqueLogIdentifier): cryptographicallyRandomNumber returns a
+        uint32_t so use two to generate a 64-bit identifier.
+
 2019-08-02  Alex Christensen  <[email protected]>
 
         Fix an internal build after r248139

Modified: trunk/Source/WTF/wtf/LoggerHelper.h (248182 => 248183)


--- trunk/Source/WTF/wtf/LoggerHelper.h	2019-08-02 21:32:09 UTC (rev 248182)
+++ trunk/Source/WTF/wtf/LoggerHelper.h	2019-08-02 21:54:26 UTC (rev 248183)
@@ -58,15 +58,16 @@
 
     const void* childLogIdentifier(uint64_t identifier) const
     {
-        static const int64_t parentMask = 0xffffffffffff0000l;
-        static const int64_t maskLowerWord = 0xffffl;
+        static const uint64_t parentMask = 0xffffffffffff0000ull;
+        static const uint64_t maskLowerWord = 0xffffull;
         return reinterpret_cast<const void*>((reinterpret_cast<uint64_t>(logIdentifier()) & parentMask) | (identifier & maskLowerWord));
     }
 
     static const void* uniqueLogIdentifier()
     {
-        static uint64_t logIdentifier = cryptographicallyRandomNumber();
-        return reinterpret_cast<const void*>(++logIdentifier);
+        static uint64_t highWord = cryptographicallyRandomNumber();
+        static uint64_t lowWord = cryptographicallyRandomNumber();
+        return reinterpret_cast<const void*>((highWord << 32) + lowWord);
     }
 #else
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to