Skip to content
Permalink
Browse files
Unreviewed, rolling out r190689
https://bugs.webkit.org/show_bug.cgi?id=149992

Fixed in other repository.

Reverted changesets:

"Unreviewed, rolling out r190572, r190593, r190594, and r190639."
https://bugs.webkit.org/show_bug.cgi?id=149897



Canonical link: https://commits.webkit.org/168130@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
litherum committed Oct 10, 2015
1 parent 7cc1334 commit e20e804fc0525ff703dc22d1874007f368aa4c3d
@@ -1,3 +1,15 @@
2015-10-09 Myles C. Maxfield <mmaxfield@apple.com>

Unreviewed, rolling out r190689
https://bugs.webkit.org/show_bug.cgi?id=149992

Fixed in other repository.

Reverted changesets:

"Unreviewed, rolling out r190572, r190593, r190594, and r190639."
https://bugs.webkit.org/show_bug.cgi?id=149897

2015-10-09 Nan Wang <n_wang@apple.com>

AX: ARIA 1.1 implement aria-colcount, aria-colindex, aria-colspan, aria-rowcount, aria-rowindex and aria-rowspan
@@ -676,5 +676,3 @@ webkit.org/b/148695 fast/shadow-dom [ Failure ImageOnlyFailure ]
# Marks as flaky (see also https://bugs.webkit.org/show_bug.cgi?id=132388)

http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-overrides.html [ Failure Pass ]

webkit.org/b/149218 http/tests/notifications/events.html [ Pass Crash Timeout ]
@@ -1,3 +1,15 @@
2015-10-09 Myles C. Maxfield <mmaxfield@apple.com>

Unreviewed, rolling out r190689
https://bugs.webkit.org/show_bug.cgi?id=149992

Fixed in other repository.

Reverted changesets:

"Unreviewed, rolling out r190572, r190593, r190594, and r190639."
https://bugs.webkit.org/show_bug.cgi?id=149897

2015-10-09 Beth Dakin <bdakin@apple.com>

Rubber-stamped by Anders Carlsson.
@@ -28,6 +28,10 @@

#include <WebKit/WKType.h>
#include <algorithm>
#include <wtf/GetPtr.h>
#include <wtf/HashFunctions.h>
#include <wtf/HashTraits.h>
#include <wtf/RefPtr.h>

namespace WebKit {

@@ -84,6 +88,15 @@ template<typename T> class WKRetainPtr {
WKRelease(ptr);
}

// Hash table deleted values, which are only constructed and never copied or destroyed.
WKRetainPtr(WTF::HashTableDeletedValueType)
: m_ptr(hashTableDeletedValue())
{
}

bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
constexpr static T hashTableDeletedValue() { return reinterpret_cast<T>(-1); }

PtrType get() const { return m_ptr; }

void clear()
@@ -250,4 +263,24 @@ using WebKit::WKRetainPtr;
using WebKit::AdoptWK;
using WebKit::adoptWK;

namespace WTF {

template <typename T> struct IsSmartPtr<WKRetainPtr<T>> {
static const bool value = true;
};

template<typename P> struct DefaultHash<WKRetainPtr<P>> {
typedef PtrHash<WKRetainPtr<P>> Hash;
};

template<typename P> struct HashTraits<WKRetainPtr<P>> : SimpleClassHashTraits<WKRetainPtr<P>> {
static P emptyValue() { return nullptr; }

typedef P PeekType;
static PeekType peek(const WKRetainPtr<P>& value) { return value.get(); }
static PeekType peek(P value) { return value; }
};

} // namespace WTF

#endif // WKRetainPtr_h
@@ -1,3 +1,15 @@
2015-10-09 Myles C. Maxfield <mmaxfield@apple.com>

Unreviewed, rolling out r190689
https://bugs.webkit.org/show_bug.cgi?id=149992

Fixed in other repository.

Reverted changesets:

"Unreviewed, rolling out r190572, r190593, r190594, and r190639."
https://bugs.webkit.org/show_bug.cgi?id=149897

2015-10-09 Brian Burg <bburg@apple.com>

Teach webkitperl how to figure out IOS versions from the SDK
@@ -110,6 +110,7 @@ add_executable(TestWebKit2
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent.cpp
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKPreferences.cpp
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKRetainPtr.cpp
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKString.cpp
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKStringJSString.cpp
${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKURL.cpp
@@ -22,6 +22,7 @@
1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; };
1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; };
1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9BC371A67482300FE5678 /* WeakPtr.cpp */; };
1CF0D3791BBF2F3D00B4EF54 /* WKRetainPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */; };
260BA5791B1D2E7B004FA07C /* DFACombiner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */; };
26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; };
26F52EAD1828827B0023D412 /* geolocationGetCurrentPosition.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26F52EAC1828820E0023D412 /* geolocationGetCurrentPosition.html */; };
@@ -470,6 +471,7 @@
1AEF994817A09F5300998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetPIDAfterAbortedProcessLaunch.cpp; sourceTree = "<group>"; };
1AFDE6541953B2C000C48FFA /* Optional.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Optional.cpp; sourceTree = "<group>"; };
1CB9BC371A67482300FE5678 /* WeakPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakPtr.cpp; sourceTree = "<group>"; };
1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKRetainPtr.cpp; sourceTree = "<group>"; };
260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFACombiner.cpp; sourceTree = "<group>"; };
260BA57A1B1D2EE2004FA07C /* DFAHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFAHelpers.h; sourceTree = "<group>"; };
261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetAndUpdateCacheModel.mm; sourceTree = "<group>"; };
@@ -1141,6 +1143,7 @@
BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
BC90995D12567BC100083756 /* WKString.cpp */,
BC9099931256ACF100083756 /* WKStringJSString.cpp */,
1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */,
);
path = WebKit2;
sourceTree = "<group>";
@@ -1745,6 +1748,7 @@
A1C4FB6E1BACCE50003742D0 /* QuickLook.mm in Sources */,
7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */,
51CB4AD81B3A079C00C1B1C6 /* ModalAlertsSPI.cpp in Sources */,
1CF0D3791BBF2F3D00B4EF54 /* WKRetainPtr.cpp in Sources */,
26F6E1F01ADC749B00DE696B /* DFAMinimizer.cpp in Sources */,
260BA5791B1D2E7B004FA07C /* DFACombiner.cpp in Sources */,
7A99D9941AD4A29D00373141 /* MenuTypesForMouseEvents.mm in Sources */,
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"

#if WK_HAVE_C_SPI

#include "PlatformUtilities.h"
#include <wtf/HashMap.h>

namespace TestWebKitAPI {

TEST(WebKit2, WKRetainPtr)
{
WKRetainPtr<WKStringRef> string1 = adoptWK(WKStringCreateWithUTF8CString("a"));
WKRetainPtr<WKStringRef> string2 = adoptWK(WKStringCreateWithUTF8CString("a"));
WKRetainPtr<WKStringRef> string3 = adoptWK(WKStringCreateWithUTF8CString("a"));
WKRetainPtr<WKStringRef> string4 = adoptWK(WKStringCreateWithUTF8CString("a"));

HashMap<WKRetainPtr<WKStringRef>, int> map;

map.set(string2, 2);
map.set(string1, 1);

EXPECT_TRUE(map.contains(string1));
EXPECT_TRUE(map.contains(string2));
EXPECT_FALSE(map.contains(string3));
EXPECT_FALSE(map.contains(string4));

EXPECT_EQ(1, map.get(string1));
EXPECT_EQ(2, map.get(string2));
}

} // namespace TestWebKitAPI

#endif
@@ -65,8 +65,8 @@ WebNotificationProvider::WebNotificationProvider()

WebNotificationProvider::~WebNotificationProvider()
{
if (m_currentNotificationManager)
WKNotificationManagerSetProvider(m_currentNotificationManager.get(), nullptr);
for (auto& manager : m_ownedNotifications)
WKNotificationManagerSetProvider(manager.key.get(), nullptr);
}

WKNotificationProviderV0 WebNotificationProvider::provider()
@@ -84,38 +84,57 @@ WKNotificationProviderV0 WebNotificationProvider::provider()
return notificationProvider;
}

void WebNotificationProvider::showWebNotification(WKPageRef, WKNotificationRef notification)
void WebNotificationProvider::showWebNotification(WKPageRef page, WKNotificationRef notification)
{
if (!m_currentNotificationManager)
return;

auto context = WKPageGetContext(page);
auto notificationManager = WKContextGetNotificationManager(context);
uint64_t id = WKNotificationGetID(notification);
ASSERT(!m_shownNotifications.contains(id));
m_shownNotifications.add(id);

WKNotificationManagerProviderDidShowNotification(m_currentNotificationManager.get(), WKNotificationGetID(notification));
ASSERT(m_ownedNotifications.contains(notificationManager));
auto addResult = m_ownedNotifications.find(notificationManager)->value.add(id);
ASSERT_UNUSED(addResult, addResult.isNewEntry);
auto addResult2 = m_owningManager.set(id, notificationManager);
ASSERT_UNUSED(addResult2, addResult2.isNewEntry);

WKNotificationManagerProviderDidShowNotification(notificationManager, id);
}

void WebNotificationProvider::closeWebNotification(WKNotificationRef notification)
{
if (!m_currentNotificationManager)
return;

uint64_t id = WKNotificationGetID(notification);
ASSERT(m_owningManager.contains(id));
auto notificationManager = m_owningManager.get(id);

ASSERT(m_ownedNotifications.contains(notificationManager));
bool success = m_ownedNotifications.find(notificationManager)->value.remove(id);
ASSERT_UNUSED(success, success);
m_owningManager.remove(id);

WKRetainPtr<WKUInt64Ref> wkID = WKUInt64Create(id);
WKRetainPtr<WKMutableArrayRef> array(AdoptWK, WKMutableArrayCreate());
WKArrayAppendItem(array.get(), wkID.get());
m_shownNotifications.remove(id);
WKNotificationManagerProviderDidCloseNotifications(m_currentNotificationManager.get(), array.get());
WKNotificationManagerProviderDidCloseNotifications(notificationManager, array.get());
}

void WebNotificationProvider::addNotificationManager(WKNotificationManagerRef manager)
{
m_currentNotificationManager = manager;
m_ownedNotifications.add(manager, HashSet<uint64_t>());
}

void WebNotificationProvider::removeNotificationManager(WKNotificationManagerRef manager)
{
auto iterator = m_ownedNotifications.find(manager);
ASSERT(iterator != m_ownedNotifications.end());
auto toRemove = iterator->value;
WKRetainPtr<WKNotificationManagerRef> guard(manager);
m_ownedNotifications.remove(iterator);
WKRetainPtr<WKMutableArrayRef> array = adoptWK(WKMutableArrayCreate());
for (uint64_t notificationID : toRemove) {
bool success = m_owningManager.remove(notificationID);
ASSERT_UNUSED(success, success);
WKArrayAppendItem(array.get(), adoptWK(WKUInt64Create(notificationID)).get());
}
WKNotificationManagerProviderDidCloseNotifications(manager, array.get());
}

WKDictionaryRef WebNotificationProvider::notificationPermissions()
@@ -126,29 +145,23 @@ WKDictionaryRef WebNotificationProvider::notificationPermissions()

void WebNotificationProvider::simulateWebNotificationClick(uint64_t notificationID)
{
if (!m_currentNotificationManager)
return;

ASSERT(m_shownNotifications.contains(notificationID));
WKNotificationManagerProviderDidClickNotification(m_currentNotificationManager.get(), notificationID);
ASSERT(m_owningManager.contains(notificationID));
WKNotificationManagerProviderDidClickNotification(m_owningManager.get(notificationID), notificationID);
}

void WebNotificationProvider::reset()
{
if (!m_currentNotificationManager) {
m_shownNotifications.clear();
return;
for (auto& notificationPair : m_ownedNotifications) {
if (notificationPair.value.isEmpty())
continue;
WKRetainPtr<WKMutableArrayRef> array = adoptWK(WKMutableArrayCreate());
for (uint64_t notificationID : notificationPair.value)
WKArrayAppendItem(array.get(), adoptWK(WKUInt64Create(notificationID)).get());

notificationPair.value.clear();
WKNotificationManagerProviderDidCloseNotifications(notificationPair.key.get(), array.get());
}

WKRetainPtr<WKMutableArrayRef> array(AdoptWK, WKMutableArrayCreate());
HashSet<uint64_t>::const_iterator itEnd = m_shownNotifications.end();
for (HashSet<uint64_t>::const_iterator it = m_shownNotifications.begin(); it != itEnd; ++it) {
WKRetainPtr<WKUInt64Ref> wkID = WKUInt64Create(*it);
WKArrayAppendItem(array.get(), wkID.get());
}

m_shownNotifications.clear();
WKNotificationManagerProviderDidCloseNotifications(m_currentNotificationManager.get(), array.get());
m_owningManager.clear();
}

} // namespace WTR
@@ -29,6 +29,7 @@
#include <WebKit/WKNotificationManager.h>
#include <WebKit/WKNotificationProvider.h>
#include <WebKit/WKRetainPtr.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>

namespace WTR {
@@ -49,8 +50,9 @@ class WebNotificationProvider {
void reset();

private:
WKRetainPtr<WKNotificationManagerRef> m_currentNotificationManager;
HashSet<uint64_t> m_shownNotifications;
// Inverses of each other.
HashMap<WKRetainPtr<WKNotificationManagerRef>, HashSet<uint64_t>> m_ownedNotifications;
HashMap<uint64_t, WKNotificationManagerRef> m_owningManager;
};

}

0 comments on commit e20e804

Please sign in to comment.