Changeset 295445 in webkit
- Timestamp:
- Jun 9, 2022 9:58:46 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/NetworkProcess/cocoa/LaunchServicesDatabaseObserver.mm
r295442 r295445 35 35 namespace WebKit { 36 36 37 #if HAVE(LSDATABASECONTEXT)38 static bool hasSystemContentDatabase()39 {40 return [LSDatabaseContext.sharedDatabaseContext respondsToSelector:@selector(getSystemContentDatabaseObject4WebKit:)];41 }42 #endif43 44 37 LaunchServicesDatabaseObserver::LaunchServicesDatabaseObserver(NetworkProcess&) 45 38 { 46 39 #if HAVE(LSDATABASECONTEXT) 47 if (hasSystemContentDatabase())48 return;49 50 40 m_observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) { 51 41 auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0)); … … 75 65 76 66 #if HAVE(LSDATABASECONTEXT) 77 if (hasSystemContentDatabase()) {78 [LSDatabaseContext.sharedDatabaseContext getSystemContentDatabaseObject4WebKit:makeBlockPtr([connection = connection] (xpc_object_t _Nullable object, NSError * _Nullable error) {79 if (!object)80 return;81 auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));82 xpc_dictionary_set_string(message.get(), XPCEndpoint::xpcMessageNameKey, LaunchServicesDatabaseXPCConstants::xpcUpdateLaunchServicesDatabaseMessageName);83 xpc_dictionary_set_value(message.get(), LaunchServicesDatabaseXPCConstants::xpcLaunchServicesDatabaseKey, object);84 85 xpc_connection_send_message(connection.get(), message.get());86 87 }).get()];88 return;89 }90 91 67 RetainPtr<id> observer = [LSDatabaseContext.sharedDatabaseContext addDatabaseChangeObserver4WebKit:^(xpc_object_t change) { 92 68 auto message = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0)); … … 108 84 { 109 85 #if HAVE(LSDATABASECONTEXT) 110 if (hasSystemContentDatabase())111 return;112 86 [LSDatabaseContext.sharedDatabaseContext removeDatabaseChangeObserver4WebKit:m_observer.get()]; 113 87 #endif
Note: See TracChangeset
for help on using the changeset viewer.