Ignore:
Timestamp:
Oct 5, 2010, 10:34:25 AM (15 years ago)
Author:
[email protected]
Message:

2010-10-05 Kwang Yul Seo <[email protected]>

Reviewed by Kent Tamura.

[BREWMP] Use PlatformRefPtr in randomNumber
https://bugs.webkit.org/show_bug.cgi?id=46989

Use PlatformRefPtr to free memory automatically.

  • wtf/RandomNumber.cpp: (WTF::randomNumber):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/RandomNumber.cpp

    r60945 r69124  
    4545#include <AEESource.h>
    4646#include <AEEStdLib.h>
     47#include <wtf/brew/RefPtrBrew.h>
     48#include <wtf/brew/ShellBrew.h>
    4749#endif
    4850
     
    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);
Note: See TracChangeset for help on using the changeset viewer.