Changeset 286777 in webkit for trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
- Timestamp:
- Dec 9, 2021, 6:46:27 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
r286764 r286777 40 40 #import "WKWebsiteDataRecordInternal.h" 41 41 #import "WebPageProxy.h" 42 #import "WebPushMessage.h"43 42 #import "WebResourceLoadStatisticsStore.h" 44 43 #import "WebsiteDataFetchOption.h" … … 763 762 } 764 763 765 -(void)_ getPendingPushMessages:(void(^)(NSArray<NSDictionary *> *))completionHandler764 -(void)_))completionHandler 766 765 { 767 766 #if ENABLE(SERVICE_WORKER) 768 _websiteDataStore->networkProcess().getPendingPushMessages(_websiteDataStore->sessionID(), [completionHandler = makeBlockPtr(completionHandler)] (const Vector<WebKit::WebPushMessage>& messages) { 769 auto result = adoptNS([[NSMutableArray alloc] initWithCapacity:messages.size()]); 770 for (auto& message : messages) 771 [result addObject:message.toDictionary()]; 772 773 completionHandler(result.get()); 774 }); 775 #endif 776 } 777 778 -(void)_processPushMessage:(NSDictionary *)pushMessageDictionary completionHandler:(void(^)(bool wasProcessed))completionHandler 779 { 780 #if ENABLE(SERVICE_WORKER) 781 auto pushMessage = WebKit::WebPushMessage::fromDictionary(pushMessageDictionary); 782 if (!pushMessage) { 783 completionHandler(false); 784 return; 785 } 786 787 _websiteDataStore->networkProcess().processPushMessage(_websiteDataStore->sessionID(), *pushMessage, [completionHandler = makeBlockPtr(completionHandler)] (bool wasProcessed) { 767 std::optional<Span<const uint8_t>> data; 768 if (message) 769 data = Span<const uint8_t> { reinterpret_cast<const uint8_t*>(message.bytes), message.length }; 770 _websiteDataStore->networkProcess().processPushMessage(_websiteDataStore->sessionID(), data, registration, [completionHandler = makeBlockPtr(completionHandler)] (bool wasProcessed) { 788 771 completionHandler(wasProcessed); 789 772 });
Note:
See TracChangeset
for help on using the changeset viewer.