WebKit Bugzilla
Attachment 343674 Details for
Bug 186017
: [WTF] RandomDevice should be initialized inside std::call_once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186017-20180627110446.patch (text/plain), 1.68 KB, created by
Yusuke Suzuki
on 2018-06-26 19:04:46 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-06-26 19:04:46 PDT
Size:
1.68 KB
patch
obsolete
>Subversion Revision: 233239 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index b4a742c64445e9619844f6d95955049534a2973d..0fd78f73a60d3b150cf0cf6861108713dc2ee881 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-26 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [WTF] RandomDevice should be initialized inside std::call_once >+ https://bugs.webkit.org/show_bug.cgi?id=186017 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ While Linux ports uses mutex-guarded static variables, Mac ports do not. >+ So we should guard static variables' initialization by using std::call_once. >+ This patch does it for RandomDevice. >+ >+ * wtf/OSRandomSource.cpp: >+ (WTF::cryptographicallyRandomValuesFromOS): >+ > 2018-06-25 David Fenton <david_fenton@apple.com> > > Unreviewed, rolling out r233120. >diff --git a/Source/WTF/wtf/OSRandomSource.cpp b/Source/WTF/wtf/OSRandomSource.cpp >index c3d08957861e469c0f5c8abb5acb7abf1204e949..016cc1be38a5c7dc8877f1995610fad20d6ac775 100644 >--- a/Source/WTF/wtf/OSRandomSource.cpp >+++ b/Source/WTF/wtf/OSRandomSource.cpp >@@ -26,6 +26,7 @@ > #include "config.h" > #include "OSRandomSource.h" > >+#include <mutex> > #include <wtf/NeverDestroyed.h> > #include <wtf/RandomDevice.h> > >@@ -33,7 +34,13 @@ namespace WTF { > > void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length) > { >- static NeverDestroyed<RandomDevice> device; >+ static LazyNeverDestroyed<RandomDevice> device; >+ static std::once_flag onceFlag; >+ std::call_once( >+ onceFlag, >+ [] { >+ device.construct(); >+ }); > device.get().cryptographicallyRandomValues(buffer, length); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186017
:
341420
| 343674