JavaScriptCore/ChangeLog

 12010-10-01 Kwang Yul Seo <skyul@company100.net>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 [BREWMP] Use PlatformRefPtr in randomNumber
 6 https://bugs.webkit.org/show_bug.cgi?id=46989
 7
 8 Use PlatformRefPtr to free memory automatically.
 9
 10 * wtf/RandomNumber.cpp:
 11 (WTF::randomNumber):
 12
1132010-10-01 Viatcheslav Ostapenko <ostapenko.viatcheslav@nokia.com>
214
315 Reviewed by Andreas Kling.
68892

JavaScriptCore/wtf/RandomNumber.cpp

@@extern "C" {
4444#include <AEEAppGen.h>
4545#include <AEESource.h>
4646#include <AEEStdLib.h>
 47#include <wtf/brew/RefPtrBrew.h>
 48#include <wtf/brew/ShellBrew.h>
4749#endif
4850
4951namespace WTF {

@@double randomNumber()
9799 return static_cast<double>(fullRandom)/static_cast<double>(1LL << 53);
98100#elif PLATFORM(BREWMP)
99101 uint32_t bits;
100  ISource* randomSource;
101 
102  IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell;
103  ISHELL_CreateInstance(shell, AEECLSID_RANDOM, reinterpret_cast<void**>(&randomSource));
104  ISOURCE_Read(randomSource, reinterpret_cast<char*>(&bits), 4);
105  ISOURCE_Release(randomSource);
 102 PlatformRefPtr<ISource> randomSource = createRefPtrInstance<ISource>(AEECLSID_RANDOM);
 103 ISOURCE_Read(randomSource.get(), reinterpret_cast<char*>(&bits), 4);
106104
107105 return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
108106#else
68892