Title: [179170] trunk
Revision
179170
Author
bfulg...@apple.com
Date
2015-01-26 22:24:09 -0800 (Mon, 26 Jan 2015)

Log Message

[Win] ASSERTION FAILED !m_ptr under AccessibilityController::winAddNotificationListener
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):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (179169 => 179170)


--- trunk/Source/WTF/ChangeLog	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/ChangeLog	2015-01-27 06:24:09 UTC (rev 179170)
@@ -1,3 +1,36 @@
+2015-01-26  Brent Fulgham  <bfulg...@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  <cdu...@apple.com>
 
         Provide implementation for WTF::DefaultHash<bool>

Modified: trunk/Source/WTF/wtf/Deque.h (179169 => 179170)


--- trunk/Source/WTF/wtf/Deque.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/wtf/Deque.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -411,7 +411,7 @@
     {
         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
@@ -428,7 +428,7 @@
             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();
     }
 
@@ -438,7 +438,7 @@
         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
@@ -456,7 +456,7 @@
             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();
     }
 
@@ -484,7 +484,7 @@
         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) {
@@ -641,7 +641,7 @@
     {
         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>
@@ -650,8 +650,8 @@
         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

Modified: trunk/Source/WTF/wtf/GetPtr.h (179169 => 179170)


--- trunk/Source/WTF/wtf/GetPtr.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/wtf/GetPtr.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -37,7 +37,7 @@
 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>

Modified: trunk/Source/WTF/wtf/HashTable.h (179169 => 179170)


--- trunk/Source/WTF/wtf/HashTable.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/wtf/HashTable.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -766,7 +766,7 @@
     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());
         }
     };
 

Modified: trunk/Source/WTF/wtf/HashTraits.h (179169 => 179170)


--- trunk/Source/WTF/wtf/HashTraits.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/wtf/HashTraits.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -105,7 +105,7 @@
 
 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(); }
 };
 
@@ -113,7 +113,7 @@
     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;
@@ -236,7 +236,7 @@
     
     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)

Modified: trunk/Source/WTF/wtf/ListHashSet.h (179169 => 179170)


--- trunk/Source/WTF/wtf/ListHashSet.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/wtf/ListHashSet.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -254,7 +254,7 @@
 
     const ValueType* get() const
     {
-        return &m_position->m_value;
+        return std::addressof(m_position->m_value);
     }
 
     const ValueType& operator*() const { return *get(); }

Modified: trunk/Source/WTF/wtf/Vector.h (179169 => 179170)


--- trunk/Source/WTF/wtf/Vector.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WTF/wtf/Vector.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -753,7 +753,7 @@
     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
 
@@ -1170,7 +1170,7 @@
         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;
 }
 
@@ -1188,7 +1188,7 @@
         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;
 }
@@ -1255,7 +1255,7 @@
     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;
 }
  

Modified: trunk/Source/WebCore/ChangeLog (179169 => 179170)


--- trunk/Source/WebCore/ChangeLog	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WebCore/ChangeLog	2015-01-27 06:24:09 UTC (rev 179170)
@@ -1,3 +1,19 @@
+2015-01-26  Brent Fulgham  <bfulg...@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  <galin...@adobe.com>
 
         The computed value of line-height:normal is incorrect

Modified: trunk/Source/WebCore/platform/win/COMPtr.h (179169 => 179170)


--- trunk/Source/WebCore/platform/win/COMPtr.h	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WebCore/platform/win/COMPtr.h	2015-01-27 06:24:09 UTC (rev 179170)
@@ -49,6 +49,7 @@
 
 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) { }
@@ -223,22 +224,22 @@
 
 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 IsSmartPtr<COMPtr<P>> {
+    static const bool value = true;
+};
 
-    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 HashTraits<COMPtr<P> > : SimpleClassHashTraits<COMPtr<P>> {
+    static P* emptyValue() { return nullptr; }
 
-    template<typename P> struct DefaultHash<COMPtr<P> > { typedef PtrHash<COMPtr<P> > Hash; };
+    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

Modified: trunk/Source/WebKit/win/ChangeLog (179169 => 179170)


--- trunk/Source/WebKit/win/ChangeLog	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WebKit/win/ChangeLog	2015-01-27 06:24:09 UTC (rev 179170)
@@ -1,3 +1,22 @@
+2015-01-26  Brent Fulgham  <bfulg...@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  <cdu...@apple.com>
 
         Rename Document::body() to Document::bodyOrFrameset() for clarity

Modified: trunk/Source/WebKit/win/WebHistory.cpp (179169 => 179170)


--- trunk/Source/WebKit/win/WebHistory.cpp	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WebKit/win/WebHistory.cpp	2015-01-27 06:24:09 UTC (rev 179170)
@@ -504,7 +504,7 @@
     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)

Modified: trunk/Source/WebKit/win/WebPreferences.cpp (179169 => 179170)


--- trunk/Source/WebKit/win/WebPreferences.cpp	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WebKit/win/WebPreferences.cpp	2015-01-27 06:24:09 UTC (rev 179170)
@@ -161,7 +161,7 @@
     if (identifierString.isEmpty())
         return sharedStandardPreferences();
 
-    return webPreferencesInstances().get(identifierString).get();
+    return webPreferencesInstances().get(identifierString);
 }
 
 void WebPreferences::setInstance(WebPreferences* instance, BSTR identifier)
@@ -182,7 +182,7 @@
     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);
 }

Modified: trunk/Source/WebKit/win/WebView.cpp (179169 => 179170)


--- trunk/Source/WebKit/win/WebView.cpp	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Source/WebKit/win/WebView.cpp	2015-01-27 06:24:09 UTC (rev 179170)
@@ -4195,7 +4195,7 @@
     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);

Modified: trunk/Tools/ChangeLog (179169 => 179170)


--- trunk/Tools/ChangeLog	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Tools/ChangeLog	2015-01-27 06:24:09 UTC (rev 179170)
@@ -1,3 +1,20 @@
+2015-01-26  Brent Fulgham  <bfulg...@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  <o...@webkit.org>
 
         [Win] Enable JSC stress tests by default

Modified: trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp (179169 => 179170)


--- trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2015-01-27 06:24:09 UTC (rev 179170)
@@ -61,8 +61,8 @@
     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)
@@ -337,8 +337,8 @@
 
 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;
 
@@ -361,7 +361,7 @@
 
         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);
     }
 }
 

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (179169 => 179170)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2015-01-27 06:14:01 UTC (rev 179169)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2015-01-27 06:24:09 UTC (rev 179170)
@@ -658,7 +658,7 @@
     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);
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to