https://bugs.webkit.org/show_bug.cgi?id=87426
<rdar://problem/
11527899>
Reviewed by Darin Adler.
Source/WebCore:
Revise COMPtr to work better with our HashMap implementation:
(1) Add a specialization for IsSmartPtr.
(2) Remove PtrHash specialization.
(3) Refresh HashTrails specialization for COMPtr to match what we
do for RefPtr.
* platform/win/COMPtr.h:
Source/WebKit/win:
Revise COMPtr to work better with our HashMap implementation. Use
modern loop syntax.
* WebHistory.cpp:
(WebHistory::visitedURL): Adjust for new COMPtr changes.
* WebPreferences.cpp:
(WebPreferences::getInstanceForIdentifier): Ditto.
(WebPreferences::removeReferenceForIdentifier): Ditto.
* WebView.cpp:
(WebView::setEditable): Ditto.
Source/WTF:
Revise internal containers to use std::addressof in preference to
to using the '&' operator.
* wtf/Deque.h:
(WTF::inlineCapacity>::append):
(WTF::inlineCapacity>::prepend):
(WTF::inlineCapacity>::removeFirst):
(WTF::inlineCapacity>::removeLast):
(WTF::inlineCapacity>::remove):
(WTF::inlineCapacity>::after):
(WTF::inlineCapacity>::before):
* wtf/GetPtr.h:
* wtf/HashTable.h:
(WTF::HashTableBucketInitializer<false>::initialize):
* wtf/HashTraits.h:
(WTF::SimpleClassHashTraits::constructDeletedValue):
(WTF::CustomHashTraits::constructDeletedValue):
* wtf/ListHashSet.h:
(WTF::ListHashSetConstIterator::get):
* wtf/Vector.h:
(WTF::Vector::swap):
(WTF::OverflowHandler>::append):
(WTF::OverflowHandler>::tryAppend):
(WTF::OverflowHandler>::insert):
Tools:
Revise COMPtr to work better with our HashMap implementation. Use
modern loop syntax.
* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(AccessibilityController::~AccessibilityController):
(AccessibilityController::winNotificationReceived):
* DumpRenderTree/win/DumpRenderTree.cpp:
(dumpBackForwardListForAllWindows):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179170
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-01-26 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
+ https://bugs.webkit.org/show_bug.cgi?id=87426
+ <rdar://problem/11527899>
+
+ Reviewed by Darin Adler.
+
+ Revise internal containers to use std::addressof in preference to
+ to using the '&' operator.
+
+ * wtf/Deque.h:
+ (WTF::inlineCapacity>::append):
+ (WTF::inlineCapacity>::prepend):
+ (WTF::inlineCapacity>::removeFirst):
+ (WTF::inlineCapacity>::removeLast):
+ (WTF::inlineCapacity>::remove):
+ (WTF::inlineCapacity>::after):
+ (WTF::inlineCapacity>::before):
+ * wtf/GetPtr.h:
+ * wtf/HashTable.h:
+ (WTF::HashTableBucketInitializer<false>::initialize):
+ * wtf/HashTraits.h:
+ (WTF::SimpleClassHashTraits::constructDeletedValue):
+ (WTF::CustomHashTraits::constructDeletedValue):
+ * wtf/ListHashSet.h:
+ (WTF::ListHashSetConstIterator::get):
+ * wtf/Vector.h:
+ (WTF::Vector::swap):
+ (WTF::OverflowHandler>::append):
+ (WTF::OverflowHandler>::tryAppend):
+ (WTF::OverflowHandler>::insert):
+
2015-01-24 Chris Dumez <cdumez@apple.com>
Provide implementation for WTF::DefaultHash<bool>
{
checkValidity();
expandCapacityIfNeeded();
- new (NotNull, &m_buffer.buffer()[m_end]) T(std::forward<U>(value));
+ new (NotNull, std::addressof(m_buffer.buffer()[m_end])) T(std::forward<U>(value));
if (m_end == m_buffer.capacity() - 1)
m_end = 0;
else
m_start = m_buffer.capacity() - 1;
else
--m_start;
- new (NotNull, &m_buffer.buffer()[m_start]) T(std::forward<U>(value));
+ new (NotNull, std::addressof(m_buffer.buffer()[m_start])) T(std::forward<U>(value));
checkValidity();
}
checkValidity();
invalidateIterators();
ASSERT(!isEmpty());
- TypeOperations::destruct(&m_buffer.buffer()[m_start], &m_buffer.buffer()[m_start + 1]);
+ TypeOperations::destruct(std::addressof(m_buffer.buffer()[m_start]), std::addressof(m_buffer.buffer()[m_start + 1]));
if (m_start == m_buffer.capacity() - 1)
m_start = 0;
else
m_end = m_buffer.capacity() - 1;
else
--m_end;
- TypeOperations::destruct(&m_buffer.buffer()[m_end], &m_buffer.buffer()[m_end + 1]);
+ TypeOperations::destruct(std::addressof(m_buffer.buffer()[m_end]), std::addressof(m_buffer.buffer()[m_end + 1]));
checkValidity();
}
invalidateIterators();
T* buffer = m_buffer.buffer();
- TypeOperations::destruct(&buffer[position], &buffer[position + 1]);
+ TypeOperations::destruct(std::addressof(buffer[position]), std::addressof(buffer[position + 1]));
// Find which segment of the circular buffer contained the remove element, and only move elements in that part.
if (position >= m_start) {
{
checkValidity();
ASSERT(m_index != m_deque->m_end);
- return &m_deque->m_buffer.buffer()[m_index];
+ return std::addressof(m_deque->m_buffer.buffer()[m_index]);
}
template<typename T, size_t inlineCapacity>
checkValidity();
ASSERT(m_index != m_deque->m_start);
if (!m_index)
- return &m_deque->m_buffer.buffer()[m_deque->m_buffer.capacity() - 1];
- return &m_deque->m_buffer.buffer()[m_index - 1];
+ return std::addressof(m_deque->m_buffer.buffer()[m_deque->m_buffer.capacity() - 1]);
+ return std::addressof(m_deque->m_buffer.buffer()[m_index - 1]);
}
} // namespace WTF
template <typename T>
struct GetPtrHelperBase<T, false /* isSmartPtr */> {
typedef T* PtrType;
- static T* getPtr(T& p) { return &p; }
+ static T* getPtr(T& p) { return std::addressof(p); }
};
template <typename T>
template<> struct HashTableBucketInitializer<false> {
template<typename Traits, typename Value> static void initialize(Value& bucket)
{
- new (NotNull, &bucket) Value(Traits::emptyValue());
+ new (NotNull, std::addressof(bucket)) Value(Traits::emptyValue());
}
};
template<typename T> struct SimpleClassHashTraits : GenericHashTraits<T> {
static const bool emptyValueIsZero = true;
- static void constructDeletedValue(T& slot) { new (NotNull, &slot) T(HashTableDeletedValue); }
+ static void constructDeletedValue(T& slot) { new (NotNull, std::addressof(slot)) T(HashTableDeletedValue); }
static bool isDeletedValue(const T& value) { return value.isHashTableDeletedValue(); }
};
typedef std::nullptr_t EmptyValueType;
static EmptyValueType emptyValue() { return nullptr; }
- static void constructDeletedValue(std::unique_ptr<T, Deleter>& slot) { new (NotNull, &slot) std::unique_ptr<T, Deleter> { reinterpret_cast<T*>(-1) }; }
+ static void constructDeletedValue(std::unique_ptr<T, Deleter>& slot) { new (NotNull, std::addressof(slot)) std::unique_ptr<T, Deleter> { reinterpret_cast<T*>(-1) }; }
static bool isDeletedValue(const std::unique_ptr<T, Deleter>& value) { return value.get() == reinterpret_cast<T*>(-1); }
typedef T* PeekType;
static void constructDeletedValue(T& slot)
{
- new (NotNull, &slot) T(T::DeletedValue);
+ new (NotNull, std::addressof(slot)) T(T::DeletedValue);
}
static bool isDeletedValue(const T& value)
const ValueType* get() const
{
- return &m_position->m_value;
+ return std::addressof(m_position->m_value);
}
const ValueType& operator*() const { return *get(); }
void swap(Vector<T, inlineCapacity, OverflowHandler>& other)
{
#if ASAN_ENABLED
- if (this == &other) // ASan will crash if we try to restrict access to the same buffer twice.
+ if (this == std::addressof(other)) // ASan will crash if we try to restrict access to the same buffer twice.
return;
#endif
CRASH();
asanBufferSizeWillChangeTo(newSize);
T* dest = end();
- VectorCopier<std::is_trivial<T>::value, U>::uninitializedCopy(data, &data[dataSize], dest);
+ VectorCopier<std::is_trivial<T>::value, U>::uninitializedCopy(data, std::addressof(data[dataSize]), dest);
m_size = newSize;
}
return false;
asanBufferSizeWillChangeTo(newSize);
T* dest = end();
- VectorCopier<std::is_trivial<T>::value, U>::uninitializedCopy(data, &data[dataSize], dest);
+ VectorCopier<std::is_trivial<T>::value, U>::uninitializedCopy(data, std::addressof(data[dataSize]), dest);
m_size = newSize;
return true;
}
asanBufferSizeWillChangeTo(newSize);
T* spot = begin() + position;
TypeOperations::moveOverlapping(spot, end(), spot + dataSize);
- VectorCopier<std::is_trivial<T>::value, U>::uninitializedCopy(data, &data[dataSize], spot);
+ VectorCopier<std::is_trivial<T>::value, U>::uninitializedCopy(data, std::addressof(data[dataSize]), spot);
m_size = newSize;
}
+2015-01-26 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
+ https://bugs.webkit.org/show_bug.cgi?id=87426
+ <rdar://problem/11527899>
+
+ Reviewed by Darin Adler.
+
+ Revise COMPtr to work better with our HashMap implementation:
+ (1) Add a specialization for IsSmartPtr.
+ (2) Remove PtrHash specialization.
+ (3) Refresh HashTrails specialization for COMPtr to match what we
+ do for RefPtr.
+
+ * platform/win/COMPtr.h:
+
2015-01-26 Sylvain Galineau <galineau@adobe.com>
The computed value of line-height:normal is incorrect
template<typename T> class COMPtr {
public:
+ typedef T* PtrType;
COMPtr() : m_ptr(0) { }
COMPtr(T* ptr) : m_ptr(ptr) { if (m_ptr) m_ptr->AddRef(); }
COMPtr(AdoptCOMTag, T* ptr) : m_ptr(ptr) { }
namespace WTF {
- template<typename P> struct HashTraits<COMPtr<P> > : GenericHashTraits<COMPtr<P> > {
- static const bool emptyValueIsZero = true;
- static void constructDeletedValue(COMPtr<P>& slot) { new (&slot) COMPtr<P>(HashTableDeletedValue); }
- static bool isDeletedValue(const COMPtr<P>& value) { return value.isHashTableDeletedValue(); }
- };
-
- template<typename P> struct PtrHash<COMPtr<P> > : PtrHash<P*> {
- using PtrHash<P*>::hash;
- static unsigned hash(const COMPtr<P>& key) { return hash(key.get()); }
- using PtrHash<P*>::equal;
- static bool equal(const COMPtr<P>& a, const COMPtr<P>& b) { return a == b; }
- static bool equal(P* a, const COMPtr<P>& b) { return a == b; }
- static bool equal(const COMPtr<P>& a, P* b) { return a == b; }
- };
-
- template<typename P> struct DefaultHash<COMPtr<P> > { typedef PtrHash<COMPtr<P> > Hash; };
+template<typename P> struct IsSmartPtr<COMPtr<P>> {
+ static const bool value = true;
+};
+
+template<typename P> struct HashTraits<COMPtr<P> > : SimpleClassHashTraits<COMPtr<P>> {
+ static P* emptyValue() { return nullptr; }
+
+ typedef P* PeekType;
+ static PeekType peek(const COMPtr<P>& value) { return value.get(); }
+ static PeekType peek(P* value) { return value; }
+};
+
+template<typename P> struct DefaultHash<COMPtr<P>> {
+ typedef PtrHash<COMPtr<P>> Hash;
+};
+
}
#endif
+2015-01-26 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
+ https://bugs.webkit.org/show_bug.cgi?id=87426
+ <rdar://problem/11527899>
+
+ Reviewed by Darin Adler.
+
+ Revise COMPtr to work better with our HashMap implementation. Use
+ modern loop syntax.
+
+ * WebHistory.cpp:
+ (WebHistory::visitedURL): Adjust for new COMPtr changes.
+ * WebPreferences.cpp:
+ (WebPreferences::getInstanceForIdentifier): Ditto.
+ (WebPreferences::removeReferenceForIdentifier): Ditto.
+ * WebView.cpp:
+ (WebView::setEditable): Ditto.
+
2015-01-26 Chris Dumez <cdumez@apple.com>
Rename Document::body() to Document::bodyOrFrameset() for clarity
if (urlString.isEmpty())
return;
- IWebHistoryItem* entry = m_entriesByURL.get(urlString).get();
+ IWebHistoryItem* entry = m_entriesByURL.get(urlString);
if (!entry) {
COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance());
if (!item)
if (identifierString.isEmpty())
return sharedStandardPreferences();
- return webPreferencesInstances().get(identifierString).get();
+ return webPreferencesInstances().get(identifierString);
}
void WebPreferences::setInstance(WebPreferences* instance, BSTR identifier)
WTF::String identifierString(identifier, SysStringLen(identifier));
if (identifierString.isEmpty())
return;
- WebPreferences* webPreference = webPreferencesInstances().get(identifierString).get();
+ WebPreferences* webPreference = webPreferencesInstances().get(identifierString);
if (webPreference && webPreference->m_refCount == 1)
webPreferencesInstances().remove(identifierString);
}
if (!m_page)
return S_OK;
- if (m_page->isEditable() == flag)
+ if (m_page->isEditable() == static_cast<bool>(flag))
return S_OK;
m_page->setEditable(flag);
+2015-01-26 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
+ https://bugs.webkit.org/show_bug.cgi?id=87426
+ <rdar://problem/11527899>
+
+ Reviewed by Darin Adler.
+
+ Revise COMPtr to work better with our HashMap implementation. Use
+ modern loop syntax.
+
+ * DumpRenderTree/win/AccessibilityControllerWin.cpp:
+ (AccessibilityController::~AccessibilityController):
+ (AccessibilityController::winNotificationReceived):
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (dumpBackForwardListForAllWindows):
+
2015-01-26 Csaba Osztrogonác <ossy@webkit.org>
[Win] Enable JSC stress tests by default
if (m_notificationsEventHook)
UnhookWinEvent(m_notificationsEventHook);
- for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it)
- JSValueUnprotect(frame->globalContext(), it->value);
+ for (auto& listener : m_notificationListeners.values())
+ JSValueUnprotect(frame->globalContext(), listener);
}
AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
void AccessibilityController::winNotificationReceived(PlatformUIElement element, const string& eventName)
{
- for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) {
- COMPtr<IServiceProvider> thisServiceProvider(Query, it->key);
+ for (auto& slot : m_notificationListeners) {
+ COMPtr<IServiceProvider> thisServiceProvider(Query, slot.key);
if (!thisServiceProvider)
continue;
JSRetainPtr<JSStringRef> jsNotification(Adopt, JSStringCreateWithUTF8CString(eventName.c_str()));
JSValueRef argument = JSValueMakeString(frame->globalContext(), jsNotification.get());
- JSObjectCallAsFunction(frame->globalContext(), it->value, 0, 1, &argument, 0);
+ JSObjectCallAsFunction(frame->globalContext(), slot.value, 0, 1, &argument, 0);
}
}
unsigned count = openWindows().size();
for (unsigned i = 0; i < count; i++) {
HWND window = openWindows()[i];
- IWebView* webView = windowToWebViewMap().get(window).get();
+ IWebView* webView = windowToWebViewMap().get(window);
dumpBackForwardList(webView);
}
}