Changeset 183186 in webkit


Ignore:
Timestamp:
Apr 23, 2015 8:52:20 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Use std::unique_ptr instead of OwnPtr in ThreadGlobalData
https://bugs.webkit.org/show_bug.cgi?id=141950

Patch by Joonghun Park <jh718.park@samsung.com> on 2015-04-23
Reviewed by Darin Adler.

No new tests, no behavior changes.

  • dom/EventNames.h:

(WebCore::EventNames::create):

  • loader/cache/CachedResourceRequestInitiators.h:
  • platform/ThreadGlobalData.cpp:

(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::destroy):

  • platform/ThreadGlobalData.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r183185 r183186  
     12015-04-23  Joonghun Park  <jh718.park@samsung.com>
     2
     3        Use std::unique_ptr instead of OwnPtr in ThreadGlobalData
     4        https://bugs.webkit.org/show_bug.cgi?id=141950
     5
     6        Reviewed by Darin Adler.
     7
     8        No new tests, no behavior changes.
     9
     10        * dom/EventNames.h:
     11        (WebCore::EventNames::create):
     12        * loader/cache/CachedResourceRequestInitiators.h:
     13        * platform/ThreadGlobalData.cpp:
     14        (WebCore::ThreadGlobalData::ThreadGlobalData):
     15        (WebCore::ThreadGlobalData::destroy):
     16        * platform/ThreadGlobalData.h:
     17
    1182015-04-23  Eric Carlson  <eric.carlson@apple.com>
    219
  • trunk/Source/WebCore/dom/EventNames.h

    r183021 r183186  
    268268#undef DOM_EVENT_NAMES_DECLARE
    269269
     270    // FIXME: The friend declaration to std::make_unique below does not work in windows port.
     271    //
     272    // template<class T, class... Args>
     273    // friend typename std::_Unique_if<T>::_Single_object std::make_unique(Args&&...);
     274    //
     275    // This create function should be deleted later and is only for keeping EventNames as private.
     276    // std::make_unique should be used instead.
     277    //
     278    template<class... Args>
     279    static std::unique_ptr<EventNames> create(Args&&... args)
     280    {
     281        return std::unique_ptr<EventNames>(new EventNames(std::forward<Args>(args)...));
     282    }
     283
    270284    // FIXME: Inelegant to call these both event names and event types.
    271285    // We should choose one term and stick to it.
  • trunk/Source/WebCore/loader/cache/CachedResourceRequestInitiators.h

    r165676 r183186  
    3333
    3434struct CachedResourceRequestInitiators {
     35    CachedResourceRequestInitiators();
     36
    3537    const AtomicString css;
    3638    const AtomicString icon;
     
    3840    WTF_MAKE_NONCOPYABLE(CachedResourceRequestInitiators); WTF_MAKE_FAST_ALLOCATED;
    3941private:
    40     CachedResourceRequestInitiators();
    4142    friend class ThreadGlobalData;
    4243};
  • trunk/Source/WebCore/platform/ThreadGlobalData.cpp

    r174113 r183186  
    5050
    5151ThreadGlobalData::ThreadGlobalData()
    52     : m_cachedResourceRequestInitiators(adoptPtr(new CachedResourceRequestInitiators))
    53     , m_eventNames(adoptPtr(new EventNames))
    54     , m_threadTimers(adoptPtr(new ThreadTimers))
     52    : m_cachedResourceRequestInitiators(std::make_unique<CachedResourceRequestInitiators>())
     53    , m_eventNames(EventNames::create())
     54    , m_threadTimers(std::make_unique<ThreadTimers>())
    5555#ifndef NDEBUG
    5656    , m_isMainThread(isMainThread())
    5757#endif
    58     , m_cachedConverterICU(adoptPtr(new ICUConverterWrapper))
     58    , m_cachedConverterICU(std::make_unique<ICUConverterWrapper>())
    5959#if PLATFORM(MAC)
    60     , m_cachedConverterTEC(adoptPtr(new TECConverterWrapper))
     60    , m_cachedConverterTEC(std::make_unique<TECConverterWrapper>())
    6161#endif
    6262{
     
    7676{
    7777#if PLATFORM(MAC)
    78     m_cachedConverterTEC.clear();
     78    m_cachedConverterTEC = nullptr;
    7979#endif
    8080
    81     m_cachedConverterICU.clear();
     81    m_cachedConverterICU = nullptr;
    8282
    83     m_eventNames.clear();
    84     m_threadTimers.clear();
     83    m_eventNames = nullptr;
     84    m_threadTimers = nullptr;
    8585}
    8686
  • trunk/Source/WebCore/platform/ThreadGlobalData.h

    r181212 r183186  
    6969
    7070    private:
    71         OwnPtr<CachedResourceRequestInitiators> m_cachedResourceRequestInitiators;
    72         OwnPtr<EventNames> m_eventNames;
    73         OwnPtr<ThreadTimers> m_threadTimers;
     71        std::unique_ptr<CachedResourceRequestInitiators> m_cachedResourceRequestInitiators;
     72        std::unique_ptr<EventNames> m_eventNames;
     73        std::unique_ptr<ThreadTimers> m_threadTimers;
    7474
    7575#ifndef NDEBUG
     
    7777#endif
    7878
    79         OwnPtr<ICUConverterWrapper> m_cachedConverterICU;
     79        std::unique_ptr<ICUConverterWrapper> m_cachedConverterICU;
    8080
    8181#if PLATFORM(MAC)
    82         OwnPtr<TECConverterWrapper> m_cachedConverterTEC;
     82        std::unique_ptr<TECConverterWrapper> m_cachedConverterTEC;
    8383#endif
    8484
Note: See TracChangeset for help on using the changeset viewer.