Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1393)

Unified Diff: third_party/WebKit/Source/wtf/OwnPtrCommon.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/OwnPtr.h ('k') | third_party/WebKit/Source/wtf/PassOwnPtr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/wtf/OwnPtr.h ('k') | third_party/WebKit/Source/wtf/PassOwnPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698