From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/JavaScriptCore/heap/Weak.h | 57 +++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 20 deletions(-) (limited to 'Source/JavaScriptCore/heap/Weak.h') diff --git a/Source/JavaScriptCore/heap/Weak.h b/Source/JavaScriptCore/heap/Weak.h index 80cdbd82c..2d7b38bb1 100644 --- a/Source/JavaScriptCore/heap/Weak.h +++ b/Source/JavaScriptCore/heap/Weak.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2012, 2013 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2012, 2013, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,11 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef Weak_h -#define Weak_h +#pragma once +#include "JSExportMacros.h" #include +#include #include +#include namespace JSC { @@ -50,35 +52,33 @@ public: { } - Weak(T*, WeakHandleOwner* = 0, void* context = 0); + inline Weak(T*, WeakHandleOwner* = 0, void* context = 0); enum HashTableDeletedValueTag { HashTableDeletedValue }; - bool isHashTableDeletedValue() const; - Weak(HashTableDeletedValueTag); + inline bool isHashTableDeletedValue() const; + inline Weak(HashTableDeletedValueTag); - Weak(Weak&&); + inline Weak(Weak&&); ~Weak() { clear(); } - void swap(Weak&); + inline void swap(Weak&); - Weak& operator=(Weak&&); + inline Weak& operator=(Weak&&); - bool operator!() const; - T* operator->() const; - T& operator*() const; - T* get() const; + inline bool operator!() const; + inline T* operator->() const; + inline T& operator*() const; + inline T* get() const; - bool was(T*) const; + inline bool was(T*) const; - // This conversion operator allows implicit conversion to bool but not to other integer types. - typedef void* (Weak::*UnspecifiedBoolType); - operator UnspecifiedBoolType*() const; + inline explicit operator bool() const; - WeakImpl* leakImpl() WARN_UNUSED_RETURN; + inline WeakImpl* leakImpl() WARN_UNUSED_RETURN; void clear() { if (!m_impl) @@ -87,11 +87,28 @@ public: } private: - static WeakImpl* hashTableDeletedValue(); + static inline WeakImpl* hashTableDeletedValue(); WeakImpl* m_impl; }; } // namespace JSC -#endif // Weak_h +namespace WTF { + +template struct VectorTraits> : SimpleClassVectorTraits { + static const bool canCompareWithMemcmp = false; +}; + +template struct HashTraits> : SimpleClassHashTraits> { + typedef JSC::Weak StorageType; + + typedef std::nullptr_t EmptyValueType; + static EmptyValueType emptyValue() { return nullptr; } + + typedef T* PeekType; + static PeekType peek(const StorageType& value) { return value.get(); } + static PeekType peek(EmptyValueType) { return PeekType(); } +}; + +} // namespace WTF -- cgit v1.2.1