Skip to content
Permalink
Browse files
Revert r295422
https://bugs.webkit.org/show_bug.cgi?id=241502

Unreviewed, revert r295422.

* Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm:
(WebKit::LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver):
(WebKit::LaunchServicesDatabaseObserver::startObserving):
(WebKit::LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver):
(WebKit::hasSystemContentDatabase): Deleted.

Canonical link: https://commits.webkit.org/251451@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pvollan committed Jun 10, 2022
1 parent 6df0c91 commit df83755201c3a35587157642578d4b885457835e
Showing 1 changed file with 0 additions and 26 deletions.
@@ -34,19 +34,9 @@

namespace WebKit {

#if HAVE(LSDATABASECONTEXT)
static bool hasSystemContentDatabase()
{
return [LSDatabaseContext.sharedDatabaseContext respondsToSelector:@selector(getSystemContentDatabaseObject4WebKit:)];
}
#endif

LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver(NetworkProcess&)
{
#if HAVE(LSDATABASECONTEXT)
if (hasSystemContentDatabase())
return;

m_observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
@@ -74,20 +64,6 @@ static bool hasSystemContentDatabase()
}

#if HAVE(LSDATABASECONTEXT)
if (hasSystemContentDatabase()) {
[LSDatabaseContext.sharedDatabaseContext getSystemContentDatabaseObject4WebKit:makeBlockPtr([connection = connection] (xpc_object_t _Nullable object, NSError * _Nullable error) {
if (!object)
return;
auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
xpc_dictionary_set_value(message.get(), LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseKey, object);

xpc_connection_send_message(connection.get(), message.get());

}).get()];
return;
}

RetainPtr<id> observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) {
auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);
@@ -107,8 +83,6 @@ static bool hasSystemContentDatabase()
LaunchServicesDatabaseObserver::~LaunchServicesDatabaseObserver()
{
#if HAVE(LSDATABASECONTEXT)
if (hasSystemContentDatabase())
return;
[LSDatabaseContext.sharedDatabaseContext removeDatabaseChangeObserver4WebKit:m_observer.get()];
#endif
}

0 comments on commit df83755

Please sign in to comment.