WebKit Bugzilla
Attachment 361706 Details for
Bug 194511
: Branch-Only: Use Async message infrastructure for storageAccess API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194511-20190211131946.patch (text/plain), 9.93 KB, created by
Brent Fulgham
on 2019-02-11 13:19:46 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2019-02-11 13:19:46 PST
Size:
9.93 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 241276) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,30 @@ >+2019-02-11 Brent Fulgham <bfulgham@apple.com> >+ >+ Branch-Only: Use Async message infrastructure for storageAccess API >+ https://bugs.webkit.org/show_bug.cgi?id=194511 >+ <rdar://problem/40966400> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Back-port the trunk async message handling implementation of the StorageAccess API methods. >+ >+ The generated async message handling code does a better job of managing the bookkeeping and error handling >+ of cross-process message passing, and gives us fewer opportunities to make coding errors that might lead >+ to dropped messages or sending messages multiple times. >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::hasStorageAccess): >+ (WebKit::WebPageProxy::requestStorageAccess): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::hasStorageAccess): >+ (WebKit::WebPage::requestStorageAccess): >+ (WebKit::nextRequestStorageAccessContextId): Deleted. >+ (WebKit::WebPage::storageAccessResponse): Deleted. >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ > 2019-02-07 Babak Shafiei <bshafiei@apple.com> > > Cherry-pick r241171. rdar://problem/47908156 >Index: Source/WebKit/UIProcess/WebPageProxy.cpp >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.cpp (revision 241264) >+++ Source/WebKit/UIProcess/WebPageProxy.cpp (working copy) >@@ -8238,19 +8238,13 @@ void WebPageProxy::loadSynchronousURLSch > } > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >-void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId) >+void WebPageProxy::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) > { >- m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, [this, webProcessContextId] (bool hasAccess) { >- m_process->send(Messages::WebPage::StorageAccessResponse(hasAccess, webProcessContextId), m_pageID); >- }); >+ m_websiteDataStore->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, m_pageID, WTFMove(completionHandler)); > } > >-void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId, bool promptEnabled) >+void WebPageProxy::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, bool promptEnabled, CompletionHandler<void(bool)>&& completionHandler) > { >- CompletionHandler<void(bool)> completionHandler = [this, protectedThis = makeRef(*this), webProcessContextId] (bool access) { >- m_process->send(Messages::WebPage::StorageAccessResponse(access, webProcessContextId), m_pageID); >- }; >- > m_websiteDataStore->requestStorageAccess(String(subFrameHost), String(topFrameHost), frameID, m_pageID, promptEnabled, [this, protectedThis = makeRef(*this), subFrameHost, topFrameHost, promptEnabled, frameID, completionHandler = WTFMove(completionHandler)] (StorageAccessStatus status) mutable { > switch (status) { > case StorageAccessStatus::CannotRequestAccess: >Index: Source/WebKit/UIProcess/WebPageProxy.h >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.h (revision 241264) >+++ Source/WebKit/UIProcess/WebPageProxy.h (working copy) >@@ -1380,8 +1380,8 @@ public: > #endif > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId); >- void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t webProcessContextId, bool prompt); >+ void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&&); >+ void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, bool prompt, CompletionHandler<void(bool)>&&); > #endif > > #if ENABLE(ATTACHMENT_ELEMENT) >Index: Source/WebKit/UIProcess/WebPageProxy.messages.in >=================================================================== >--- Source/WebKit/UIProcess/WebPageProxy.messages.in (revision 241264) >+++ Source/WebKit/UIProcess/WebPageProxy.messages.in (working copy) >@@ -534,8 +534,8 @@ messages -> WebPageProxy { > LoadSynchronousURLSchemeTask(struct WebKit::URLSchemeTaskParameters parameters) -> (WebCore::ResourceResponse response, WebCore::ResourceError error, IPC::DataReference data) Delayed > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >- HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t contextID) >- RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, uint64_t contextID, bool prompt) >+ HasStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID) -> (bool hasAccess) Async >+ RequestStorageAccess(String subFrameHost, String topFrameHost, uint64_t frameID, bool prompt) -> (bool grantedAccess) Async > #endif > > #if ENABLE(ATTACHMENT_ELEMENT) >Index: Source/WebKit/WebProcess/WebPage/WebPage.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.cpp (revision 241264) >+++ Source/WebKit/WebProcess/WebPage/WebPage.cpp (working copy) >@@ -6331,40 +6331,15 @@ void WebPage::frameBecameRemote(uint64_t > } > > #if ENABLE(RESOURCE_LOAD_STATISTICS) >-static uint64_t nextRequestStorageAccessContextId() >+void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) > { >- static uint64_t nextContextId = 0; >- return ++nextContextId; >-} >- >-void WebPage::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback) >-{ >- auto contextId = nextRequestStorageAccessContextId(); >- auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); >- ASSERT(addResult.isNewEntry); >- if (addResult.iterator->value) >- send(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, contextId)); >- else >- callback(false); >+ sendWithAsyncReply(Messages::WebPageProxy::HasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID), WTFMove(completionHandler)); > } > >-void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback) >+void WebPage::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& completionHandler) > { >- auto contextId = nextRequestStorageAccessContextId(); >- auto addResult = m_storageAccessResponseCallbackMap.add(contextId, WTFMove(callback)); >- ASSERT(addResult.isNewEntry); >- if (addResult.iterator->value) { >- bool promptEnabled = RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled(); >- send(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, contextId, promptEnabled)); >- } else >- callback(false); >-} >- >-void WebPage::storageAccessResponse(bool wasGranted, uint64_t contextId) >-{ >- auto callback = m_storageAccessResponseCallbackMap.take(contextId); >- ASSERT(callback); >- callback(wasGranted); >+ bool promptEnabled = RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled(); >+ sendWithAsyncReply(Messages::WebPageProxy::RequestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, promptEnabled), WTFMove(completionHandler)); > } > #endif > >Index: Source/WebKit/WebProcess/WebPage/WebPage.h >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.h (revision 241264) >+++ Source/WebKit/WebProcess/WebPage/WebPage.h (working copy) >@@ -1110,7 +1110,6 @@ public: > #if ENABLE(RESOURCE_LOAD_STATISTICS) > void hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback); > void requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, CompletionHandler<void(bool)>&& callback); >- void storageAccessResponse(bool wasGranted, uint64_t contextId); > #endif > > void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback); >@@ -1793,7 +1792,6 @@ private: > HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap; > HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap; > >- HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap; > HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap; > > #if ENABLE(APPLICATION_MANIFEST) >Index: Source/WebKit/WebProcess/WebPage/WebPage.messages.in >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.messages.in (revision 241264) >+++ Source/WebKit/WebProcess/WebPage/WebPage.messages.in (working copy) >@@ -531,10 +531,6 @@ messages -> WebPage LegacyReceiver { > > SetIsSuspended(bool suspended) > >-#if ENABLE(RESOURCE_LOAD_STATISTICS) >- StorageAccessResponse(bool wasGranted, uint64_t contextId) >-#endif >- > #if ENABLE(ATTACHMENT_ELEMENT) > InsertAttachment(String identifier, Optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID) > UpdateAttachmentAttributes(String identifier, Optional<uint64_t> fileSize, String contentType, String fileName, IPC::SharedBufferDataReference enclosingImageData, WebKit::CallbackID callbackID)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
achristensen
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194511
: 361706