| Index: third_party/WebKit/Source/wtf/OwnPtrCommon.h
|
| diff --git a/third_party/WebKit/Source/core/events/PageTransitionEvent.h b/third_party/WebKit/Source/wtf/OwnPtrCommon.h
|
| similarity index 50%
|
| copy from third_party/WebKit/Source/core/events/PageTransitionEvent.h
|
| copy to third_party/WebKit/Source/wtf/OwnPtrCommon.h
|
| index 2e9cd82240f1efa0520abe29186c30381b09c546..89e24895029c0dac37743809b1784df3992a3703 100644
|
| --- a/third_party/WebKit/Source/core/events/PageTransitionEvent.h
|
| +++ b/third_party/WebKit/Source/wtf/OwnPtrCommon.h
|
| @@ -1,5 +1,8 @@
|
| /*
|
| * Copyright (C) 2009 Apple Inc. All rights reserved.
|
| + * Copyright (C) 2009 Torch Mobile, Inc.
|
| + * Copyright (C) 2010 Company 100 Inc.
|
| + * Copyright (C) 2013 Intel Corporation. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions
|
| @@ -23,46 +26,52 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef PageTransitionEvent_h
|
| -#define PageTransitionEvent_h
|
| +#ifndef WTF_OwnPtrCommon_h
|
| +#define WTF_OwnPtrCommon_h
|
|
|
| -#include "core/events/Event.h"
|
| -#include "core/events/PageTransitionEventInit.h"
|
| +#include "wtf/Assertions.h"
|
| +#include "wtf/TypeTraits.h"
|
|
|
| -namespace blink {
|
| +namespace WTF {
|
|
|
| -class PageTransitionEvent final : public Event {
|
| - DEFINE_WRAPPERTYPEINFO();
|
| -public:
|
| - static PageTransitionEvent* create()
|
| - {
|
| - return new PageTransitionEvent;
|
| - }
|
| - static PageTransitionEvent* create(const AtomicString& type, bool persisted)
|
| +class RefCountedBase;
|
| +class ThreadSafeRefCountedBase;
|
| +
|
| +template<typename T>
|
| +struct IsRefCounted {
|
| + STATIC_ONLY(IsRefCounted);
|
| + static const bool value = IsSubclass<T, RefCountedBase>::value
|
| + || IsSubclass<T, ThreadSafeRefCountedBase>::value;
|
| +};
|
| +
|
| +template <typename T>
|
| +struct OwnedPtrDeleter {
|
| + STATIC_ONLY(OwnedPtrDeleter);
|
| + static void deletePtr(T* ptr)
|
| {
|
| - return new PageTransitionEvent(type, persisted);
|
| + static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted objects");
|
| + static_assert(sizeof(T) > 0, "type must be complete");
|
| + delete ptr;
|
| }
|
| - static PageTransitionEvent* create(const AtomicString& type, const PageTransitionEventInit& initializer)
|
| +};
|
| +
|
| +template <typename T>
|
| +struct OwnedPtrDeleter<T[]> {
|
| + STATIC_ONLY(OwnedPtrDeleter);
|
| + static void deletePtr(T* ptr)
|
| {
|
| - return new PageTransitionEvent(type, initializer);
|
| + static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted objects");
|
| + static_assert(sizeof(T) > 0, "type must be complete");
|
| + delete[] ptr;
|
| }
|
| +};
|
|
|
| - ~PageTransitionEvent() override;
|
| -
|
| - const AtomicString& interfaceName() const override;
|
| -
|
| - bool persisted() const { return m_persisted; }
|
| -
|
| - DECLARE_VIRTUAL_TRACE();
|
| -
|
| -private:
|
| - PageTransitionEvent();
|
| - PageTransitionEvent(const AtomicString& type, bool persisted);
|
| - PageTransitionEvent(const AtomicString&, const PageTransitionEventInit&);
|
| -
|
| - bool m_persisted;
|
| +template <class T, int n>
|
| +struct OwnedPtrDeleter<T[n]> {
|
| + STATIC_ONLY(OwnedPtrDeleter);
|
| + static_assert(sizeof(T) < 0, "do not use array with size as type");
|
| };
|
|
|
| -} // namespace blink
|
| +} // namespace WTF
|
|
|
| -#endif // PageTransitionEvent_h
|
| +#endif // WTF_OwnPtrCommon_h
|
|
|