Bug 208610 - Construct fewer unnecessary temporary WebProcessPool objects in WebsiteDataStore implementation
Summary: Construct fewer unnecessary temporary WebProcessPool objects in WebsiteDataSt...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 208541 208619
  Show dependency treegraph
 
Reported: 2020-03-04 15:38 PST by Chris Dumez
Modified: 2020-03-04 18:05 PST (History)
7 users (show)

See Also:


Attachments
Patch (32.75 KB, patch)
2020-03-04 16:12 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (32.75 KB, patch)
2020-03-04 16:50 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (33.12 KB, patch)
2020-03-04 17:09 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (33.12 KB, patch)
2020-03-04 17:16 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-03-04 15:38:35 PST
Construct less unnecessary temporary WebProcessPool objects in WebsiteDataStore implementation.
Comment 1 Chris Dumez 2020-03-04 16:12:49 PST
Created attachment 392502 [details]
Patch
Comment 2 Chris Dumez 2020-03-04 16:50:21 PST
Created attachment 392510 [details]
Patch
Comment 3 Said Abou-Hallawa 2020-03-04 17:05:45 PST
Comment on attachment 392510 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=392510&action=review

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1380
> -    for (auto& processPool : ensureProcessPools()) {
> +    for (auto& processPool : processPools()) {
>          if (auto* process = processPool->networkProcess()) {
>              process->isRegisteredAsSubresourceUnder(m_sessionID, WebCore::RegistrableDomain { subresourceURL }, WebCore::RegistrableDomain { topFrameURL }, WTFMove(completionHandler));
> -            break;
> -        } else {
> -            ASSERT_NOT_REACHED();
> -            completionHandler(false);
> -            break;
> +            return;
>          }
> +        break;
>      }
> +    completionHandler(false);

I am not sure what this function is supposed to do. Does it expect (processPools().size() == 1 and processPools()[0]->networkProcess() != nullptr)? if this is the case why do we use a for-loop?

> Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1481
> +    completionHandler();

completionHandler is moved above when creating callbackAggregator.
Comment 4 Chris Dumez 2020-03-04 17:09:30 PST
(In reply to Said Abou-Hallawa from comment #3)
> Comment on attachment 392510 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=392510&action=review
> 
> > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1380
> > -    for (auto& processPool : ensureProcessPools()) {
> > +    for (auto& processPool : processPools()) {
> >          if (auto* process = processPool->networkProcess()) {
> >              process->isRegisteredAsSubresourceUnder(m_sessionID, WebCore::RegistrableDomain { subresourceURL }, WebCore::RegistrableDomain { topFrameURL }, WTFMove(completionHandler));
> > -            break;
> > -        } else {
> > -            ASSERT_NOT_REACHED();
> > -            completionHandler(false);
> > -            break;
> > +            return;
> >          }
> > +        break;
> >      }
> > +    completionHandler(false);
> 
> I am not sure what this function is supposed to do. Does it expect
> (processPools().size() == 1 and processPools()[0]->networkProcess() !=
> nullptr)? if this is the case why do we use a for-loop?
> 
> > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:1481
> > +    completionHandler();
> 
> completionHandler is moved above when creating callbackAggregator.

Thanks for catching this. Will fix before landing.
Comment 5 Chris Dumez 2020-03-04 17:09:46 PST
Created attachment 392514 [details]
Patch
Comment 6 WebKit Commit Bot 2020-03-04 17:12:26 PST
Comment on attachment 392514 [details]
Patch

Rejecting attachment 392514 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 392514, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in Source/WebKit/ChangeLog contains OOPS!.

Full output: https://webkit-queues.webkit.org/results/13333735
Comment 7 Chris Dumez 2020-03-04 17:16:02 PST
Created attachment 392515 [details]
Patch
Comment 8 WebKit Commit Bot 2020-03-04 18:04:54 PST
Comment on attachment 392515 [details]
Patch

Clearing flags on attachment: 392515

Committed r257893: <https://trac.webkit.org/changeset/257893>
Comment 9 WebKit Commit Bot 2020-03-04 18:04:56 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2020-03-04 18:05:18 PST
<rdar://problem/60066720>