| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2010 Company 100 Inc. |
| 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 3 * | 6 * |
| 4 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 6 * are met: | 9 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 11 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 12 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 13 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 14 * documentation and/or other materials provided with the distribution. |
| 12 * | 15 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 16 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 27 */ |
| 25 | 28 |
| 26 #ifndef PageTransitionEvent_h | 29 #ifndef WTF_OwnPtrCommon_h |
| 27 #define PageTransitionEvent_h | 30 #define WTF_OwnPtrCommon_h |
| 28 | 31 |
| 29 #include "core/events/Event.h" | 32 #include "wtf/Assertions.h" |
| 30 #include "core/events/PageTransitionEventInit.h" | 33 #include "wtf/TypeTraits.h" |
| 31 | 34 |
| 32 namespace blink { | 35 namespace WTF { |
| 33 | 36 |
| 34 class PageTransitionEvent final : public Event { | 37 class RefCountedBase; |
| 35 DEFINE_WRAPPERTYPEINFO(); | 38 class ThreadSafeRefCountedBase; |
| 36 public: | |
| 37 static PageTransitionEvent* create() | |
| 38 { | |
| 39 return new PageTransitionEvent; | |
| 40 } | |
| 41 static PageTransitionEvent* create(const AtomicString& type, bool persisted) | |
| 42 { | |
| 43 return new PageTransitionEvent(type, persisted); | |
| 44 } | |
| 45 static PageTransitionEvent* create(const AtomicString& type, const PageTrans
itionEventInit& initializer) | |
| 46 { | |
| 47 return new PageTransitionEvent(type, initializer); | |
| 48 } | |
| 49 | 39 |
| 50 ~PageTransitionEvent() override; | 40 template<typename T> |
| 51 | 41 struct IsRefCounted { |
| 52 const AtomicString& interfaceName() const override; | 42 STATIC_ONLY(IsRefCounted); |
| 53 | 43 static const bool value = IsSubclass<T, RefCountedBase>::value |
| 54 bool persisted() const { return m_persisted; } | 44 || IsSubclass<T, ThreadSafeRefCountedBase>::value; |
| 55 | |
| 56 DECLARE_VIRTUAL_TRACE(); | |
| 57 | |
| 58 private: | |
| 59 PageTransitionEvent(); | |
| 60 PageTransitionEvent(const AtomicString& type, bool persisted); | |
| 61 PageTransitionEvent(const AtomicString&, const PageTransitionEventInit&); | |
| 62 | |
| 63 bool m_persisted; | |
| 64 }; | 45 }; |
| 65 | 46 |
| 66 } // namespace blink | 47 template <typename T> |
| 48 struct OwnedPtrDeleter { |
| 49 STATIC_ONLY(OwnedPtrDeleter); |
| 50 static void deletePtr(T* ptr) |
| 51 { |
| 52 static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted object
s"); |
| 53 static_assert(sizeof(T) > 0, "type must be complete"); |
| 54 delete ptr; |
| 55 } |
| 56 }; |
| 67 | 57 |
| 68 #endif // PageTransitionEvent_h | 58 template <typename T> |
| 59 struct OwnedPtrDeleter<T[]> { |
| 60 STATIC_ONLY(OwnedPtrDeleter); |
| 61 static void deletePtr(T* ptr) |
| 62 { |
| 63 static_assert(!IsRefCounted<T>::value, "use RefPtr for RefCounted object
s"); |
| 64 static_assert(sizeof(T) > 0, "type must be complete"); |
| 65 delete[] ptr; |
| 66 } |
| 67 }; |
| 68 |
| 69 template <class T, int n> |
| 70 struct OwnedPtrDeleter<T[n]> { |
| 71 STATIC_ONLY(OwnedPtrDeleter); |
| 72 static_assert(sizeof(T) < 0, "do not use array with size as type"); |
| 73 }; |
| 74 |
| 75 } // namespace WTF |
| 76 |
| 77 #endif // WTF_OwnPtrCommon_h |
| OLD | NEW |