Changeset 190836 in webkit
- Timestamp:
- Oct 9, 2015 8:52:41 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190833 r190836 1 2015-10-09 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Unreviewed, rolling out r190689 4 https://bugs.webkit.org/show_bug.cgi?id=149992 5 6 Fixed in other repository. 7 8 Reverted changesets: 9 10 "Unreviewed, rolling out r190572, r190593, r190594, and r190639." 11 https://bugs.webkit.org/show_bug.cgi?id=149897 12 1 13 2015-10-09 Nan Wang <n_wang@apple.com> 2 14 -
trunk/LayoutTests/TestExpectations
r190689 r190836 677 677 678 678 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-overrides.html [ Failure Pass ] 679 680 webkit.org/b/149218 http/tests/notifications/events.html [ Pass Crash Timeout ] -
trunk/Source/WebKit2/ChangeLog
r190832 r190836 1 2015-10-09 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Unreviewed, rolling out r190689 4 https://bugs.webkit.org/show_bug.cgi?id=149992 5 6 Fixed in other repository. 7 8 Reverted changesets: 9 10 "Unreviewed, rolling out r190572, r190593, r190594, and r190639." 11 https://bugs.webkit.org/show_bug.cgi?id=149897 12 1 13 2015-10-09 Beth Dakin <bdakin@apple.com> 2 14 -
trunk/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h
r190689 r190836 29 29 #include <WebKit/WKType.h> 30 30 #include <algorithm> 31 #include <wtf/GetPtr.h> 32 #include <wtf/HashFunctions.h> 33 #include <wtf/HashTraits.h> 34 #include <wtf/RefPtr.h> 31 35 32 36 namespace WebKit { … … 84 88 WKRelease(ptr); 85 89 } 90 91 // Hash table deleted values, which are only constructed and never copied or destroyed. 92 WKRetainPtr(WTF::HashTableDeletedValueType) 93 : m_ptr(hashTableDeletedValue()) 94 { 95 } 96 97 bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } 98 constexpr static T hashTableDeletedValue() { return reinterpret_cast<T>(-1); } 86 99 87 100 PtrType get() const { return m_ptr; } … … 251 264 using WebKit::adoptWK; 252 265 266 namespace WTF { 267 268 template <typename T> struct IsSmartPtr<WKRetainPtr<T>> { 269 static const bool value = true; 270 }; 271 272 template<typename P> struct DefaultHash<WKRetainPtr<P>> { 273 typedef PtrHash<WKRetainPtr<P>> Hash; 274 }; 275 276 template<typename P> struct HashTraits<WKRetainPtr<P>> : SimpleClassHashTraits<WKRetainPtr<P>> { 277 static P emptyValue() { return nullptr; } 278 279 typedef P PeekType; 280 static PeekType peek(const WKRetainPtr<P>& value) { return value.get(); } 281 static PeekType peek(P value) { return value; } 282 }; 283 284 } // namespace WTF 285 253 286 #endif // WKRetainPtr_h -
trunk/Tools/ChangeLog
r190821 r190836 1 2015-10-09 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Unreviewed, rolling out r190689 4 https://bugs.webkit.org/show_bug.cgi?id=149992 5 6 Fixed in other repository. 7 8 Reverted changesets: 9 10 "Unreviewed, rolling out r190572, r190593, r190594, and r190639." 11 https://bugs.webkit.org/show_bug.cgi?id=149897 12 1 13 2015-10-09 Brian Burg <bburg@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/PlatformGTK.cmake
r190689 r190836 111 111 ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp 112 112 ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKPreferences.cpp 113 ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKRetainPtr.cpp 113 114 ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKString.cpp 114 115 ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKStringJSString.cpp -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r190689 r190836 23 23 1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; }; 24 24 1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */; }; 25 1CF0D3791BBF2F3D00B4EF54 /* WKRetainPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */; }; 25 26 260BA5791B1D2E7B004FA07C /* DFACombiner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */; }; 26 27 26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; }; … … 471 472 1AFDE6541953B2C000C48FFA /* Optional.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Optional.cpp; sourceTree = "<group>"; }; 472 473 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakPtr.cpp; sourceTree = "<group>"; }; 474 1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKRetainPtr.cpp; sourceTree = "<group>"; }; 473 475 260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFACombiner.cpp; sourceTree = "<group>"; }; 474 476 260BA57A1B1D2EE2004FA07C /* DFAHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFAHelpers.h; sourceTree = "<group>"; }; … … 1142 1144 BC90995D12567BC100083756 /* WKString.cpp */, 1143 1145 BC9099931256ACF100083756 /* WKStringJSString.cpp */, 1146 1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */, 1144 1147 ); 1145 1148 path = WebKit2; … … 1746 1749 7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */, 1747 1750 51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */, 1751 1CF0D3791BBF2F3D00B4EF54 /* WKRetainPtr.cpp in Sources */, 1748 1752 26F6E1F01ADC749B00DE696B /* DFAMinimizer.cpp in Sources */, 1749 1753 260BA5791B1D2E7B004FA07C /* DFACombiner.cpp in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKRetainPtr.cpp
r190835 r190836 1 1 /* 2 * Copyright (C) 201 2Apple Inc. All rights reserved.2 * Copyright (C) 2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef WebNotificationProvider_h 27 #define WebNotificationProvider_h 26 #include "config.h" 28 27 29 #include <WebKit/WKNotificationManager.h> 30 #include <WebKit/WKNotificationProvider.h> 31 #include <WebKit/WKRetainPtr.h> 32 #include <wtf/HashSet.h> 28 #if WK_HAVE_C_SPI 33 29 34 namespace WTR { 30 #include "PlatformUtilities.h" 31 #include <wtf/HashMap.h> 35 32 36 class WebNotificationProvider { 37 public: 38 WebNotificationProvider(); 39 ~WebNotificationProvider(); 40 WKNotificationProviderV0 provider(); 33 namespace TestWebKitAPI { 41 34 42 void showWebNotification(WKPageRef, WKNotificationRef); 43 void closeWebNotification(WKNotificationRef); 44 void addNotificationManager(WKNotificationManagerRef); 45 void removeNotificationManager(WKNotificationManagerRef); 46 WKDictionaryRef notificationPermissions(); 35 TEST(WebKit2, WKRetainPtr) 36 { 37 WKRetainPtr<WKStringRef> string1 = adoptWK(WKStringCreateWithUTF8CString("a")); 38 WKRetainPtr<WKStringRef> string2 = adoptWK(WKStringCreateWithUTF8CString("a")); 39 WKRetainPtr<WKStringRef> string3 = adoptWK(WKStringCreateWithUTF8CString("a")); 40 WKRetainPtr<WKStringRef> string4 = adoptWK(WKStringCreateWithUTF8CString("a")); 47 41 48 void simulateWebNotificationClick(uint64_t notificationID); 49 void reset(); 42 HashMap<WKRetainPtr<WKStringRef>, int> map; 50 43 51 private: 52 WKRetainPtr<WKNotificationManagerRef> m_currentNotificationManager; 53 HashSet<uint64_t> m_shownNotifications; 54 }; 44 map.set(string2, 2); 45 map.set(string1, 1); 55 46 47 EXPECT_TRUE(map.contains(string1)); 48 EXPECT_TRUE(map.contains(string2)); 49 EXPECT_FALSE(map.contains(string3)); 50 EXPECT_FALSE(map.contains(string4)); 51 52 EXPECT_EQ(1, map.get(string1)); 53 EXPECT_EQ(2, map.get(string2)); 56 54 } 57 55 56 } // namespace TestWebKitAPI 57 58 58 #endif -
trunk/Tools/WebKitTestRunner/WebNotificationProvider.cpp
r190689 r190836 66 66 WebNotificationProvider::~WebNotificationProvider() 67 67 { 68 if (m_currentNotificationManager)69 WKNotificationManagerSetProvider(m _currentNotificationManager.get(), nullptr);68 for (auto& manager : m_ownedNotifications) 69 WKNotificationManagerSetProvider(manager.key.get(), nullptr); 70 70 } 71 71 … … 85 85 } 86 86 87 void WebNotificationProvider::showWebNotification(WKPageRef , WKNotificationRef notification)87 void WebNotificationProvider::showWebNotification(WKPageRef page, WKNotificationRef notification) 88 88 { 89 if (!m_currentNotificationManager) 90 return; 89 auto context = WKPageGetContext(page); 90 auto notificationManager = WKContextGetNotificationManager(context); 91 uint64_t id = WKNotificationGetID(notification); 91 92 92 uint64_t id = WKNotificationGetID(notification); 93 ASSERT(!m_shownNotifications.contains(id)); 94 m_shownNotifications.add(id); 93 ASSERT(m_ownedNotifications.contains(notificationManager)); 94 auto addResult = m_ownedNotifications.find(notificationManager)->value.add(id); 95 ASSERT_UNUSED(addResult, addResult.isNewEntry); 96 auto addResult2 = m_owningManager.set(id, notificationManager); 97 ASSERT_UNUSED(addResult2, addResult2.isNewEntry); 95 98 96 WKNotificationManagerProviderDidShowNotification( m_currentNotificationManager.get(), WKNotificationGetID(notification));99 WKNotificationManagerProviderDidShowNotification(notificationManager, id); 97 100 } 98 101 99 102 void WebNotificationProvider::closeWebNotification(WKNotificationRef notification) 100 103 { 101 if (!m_currentNotificationManager) 102 return; 104 uint64_t id = WKNotificationGetID(notification); 105 ASSERT(m_owningManager.contains(id)); 106 auto notificationManager = m_owningManager.get(id); 103 107 104 uint64_t id = WKNotificationGetID(notification); 108 ASSERT(m_ownedNotifications.contains(notificationManager)); 109 bool success = m_ownedNotifications.find(notificationManager)->value.remove(id); 110 ASSERT_UNUSED(success, success); 111 m_owningManager.remove(id); 112 105 113 WKRetainPtr<WKUInt64Ref> wkID = WKUInt64Create(id); 106 114 WKRetainPtr<WKMutableArrayRef> array(AdoptWK, WKMutableArrayCreate()); 107 115 WKArrayAppendItem(array.get(), wkID.get()); 108 m_shownNotifications.remove(id); 109 WKNotificationManagerProviderDidCloseNotifications(m_currentNotificationManager.get(), array.get()); 116 WKNotificationManagerProviderDidCloseNotifications(notificationManager, array.get()); 110 117 } 111 118 112 119 void WebNotificationProvider::addNotificationManager(WKNotificationManagerRef manager) 113 120 { 114 m_ currentNotificationManager = manager;121 m_ownedNotifications.add(manager, HashSet<uint64_t>()); 115 122 } 116 123 117 124 void WebNotificationProvider::removeNotificationManager(WKNotificationManagerRef manager) 118 125 { 126 auto iterator = m_ownedNotifications.find(manager); 127 ASSERT(iterator != m_ownedNotifications.end()); 128 auto toRemove = iterator->value; 129 WKRetainPtr<WKNotificationManagerRef> guard(manager); 130 m_ownedNotifications.remove(iterator); 131 WKRetainPtr<WKMutableArrayRef> array = adoptWK(WKMutableArrayCreate()); 132 for (uint64_t notificationID : toRemove) { 133 bool success = m_owningManager.remove(notificationID); 134 ASSERT_UNUSED(success, success); 135 WKArrayAppendItem(array.get(), adoptWK(WKUInt64Create(notificationID)).get()); 136 } 137 WKNotificationManagerProviderDidCloseNotifications(manager, array.get()); 119 138 } 120 139 … … 127 146 void WebNotificationProvider::simulateWebNotificationClick(uint64_t notificationID) 128 147 { 129 if (!m_currentNotificationManager) 130 return; 131 132 ASSERT(m_shownNotifications.contains(notificationID)); 133 WKNotificationManagerProviderDidClickNotification(m_currentNotificationManager.get(), notificationID); 148 ASSERT(m_owningManager.contains(notificationID)); 149 WKNotificationManagerProviderDidClickNotification(m_owningManager.get(notificationID), notificationID); 134 150 } 135 151 136 152 void WebNotificationProvider::reset() 137 153 { 138 if (!m_currentNotificationManager) { 139 m_shownNotifications.clear(); 140 return; 154 for (auto& notificationPair : m_ownedNotifications) { 155 if (notificationPair.value.isEmpty()) 156 continue; 157 WKRetainPtr<WKMutableArrayRef> array = adoptWK(WKMutableArrayCreate()); 158 for (uint64_t notificationID : notificationPair.value) 159 WKArrayAppendItem(array.get(), adoptWK(WKUInt64Create(notificationID)).get()); 160 161 notificationPair.value.clear(); 162 WKNotificationManagerProviderDidCloseNotifications(notificationPair.key.get(), array.get()); 141 163 } 142 143 WKRetainPtr<WKMutableArrayRef> array(AdoptWK, WKMutableArrayCreate()); 144 HashSet<uint64_t>::const_iterator itEnd = m_shownNotifications.end(); 145 for (HashSet<uint64_t>::const_iterator it = m_shownNotifications.begin(); it != itEnd; ++it) { 146 WKRetainPtr<WKUInt64Ref> wkID = WKUInt64Create(*it); 147 WKArrayAppendItem(array.get(), wkID.get()); 148 } 149 150 m_shownNotifications.clear(); 151 WKNotificationManagerProviderDidCloseNotifications(m_currentNotificationManager.get(), array.get()); 164 m_owningManager.clear(); 152 165 } 153 166 -
trunk/Tools/WebKitTestRunner/WebNotificationProvider.h
r190689 r190836 30 30 #include <WebKit/WKNotificationProvider.h> 31 31 #include <WebKit/WKRetainPtr.h> 32 #include <wtf/HashMap.h> 32 33 #include <wtf/HashSet.h> 33 34 … … 50 51 51 52 private: 52 WKRetainPtr<WKNotificationManagerRef> m_currentNotificationManager; 53 HashSet<uint64_t> m_shownNotifications; 53 // Inverses of each other. 54 HashMap<WKRetainPtr<WKNotificationManagerRef>, HashSet<uint64_t>> m_ownedNotifications; 55 HashMap<uint64_t, WKNotificationManagerRef> m_owningManager; 54 56 }; 55 57
Note: See TracChangeset
for help on using the changeset viewer.