Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling network service #15791

Closed
8 of 15 tasks
deepak1556 opened this issue Nov 21, 2018 · 5 comments
Closed
8 of 15 tasks

Enabling network service #15791

deepak1556 opened this issue Nov 21, 2018 · 5 comments
Assignees

Comments

@deepak1556
Copy link
Member

deepak1556 commented Nov 21, 2018

This is a meta bug to track all the work required to use the network service from chromium, which is being experimented in canary and stable channels at the moment. To use the service, pass --enable-features=NetworkService

What is network service ?

As a part of chrome modularization project, network code is being moved from browser process into a separate process.

High level Design doc: https://docs.google.com/document/d/1wAHLw9h7gGuqJNCgG1mP1BmLtCGfZ2pys-PdZQ1vg7M/edit?pref=2&pli=1#heading=h.w406cmqiibno

Upstream meta bug: https://crbug.com/598073

Changes required in Electron

As we move to consuming the service, we will start to remove all usages from //net and use interfaces from //services/network. So existing terminologies like URLRequest, URLRequestContext, URLRequestJob, URLFetcher will now be URLLoaderRequest, NetworkContext, URLLoaderJob, URLLoader

@deepak1556
Copy link
Member Author

Chromium 74 has this service enabled by default on all desktop platforms, will work on enabling it following the upgrade.

deepak1556 added a commit that referenced this issue Mar 6, 2019
deepak1556 added a commit that referenced this issue Mar 7, 2019
MarshallOfSound pushed a commit that referenced this issue Mar 8, 2019
MarshallOfSound pushed a commit that referenced this issue Mar 8, 2019
@deepak1556
Copy link
Member Author

deepak1556 commented Mar 20, 2019

The next phase is to remove usage of net::URLRequestContext and net::URLRequestContextGetter in the codebase. The following user facing modules are the primary consumers

  • Obtain NetworkContext from StoragePartition, since we have 1:1 relationship with BrowserContext, prefer the following
content::BrowserContext::GetDefaultStoragePartition(browser_context)->GetNetworkContext()

or we have a new class atom::NetworkContextService that has 1:1 relationship with
BrowserContext , add a getter there and use it. Consider this the new version of
URLRequestContextGetter

  1. Session Module (Assigned: @nornagon)
    • Session::DoCacheAction
      • Clear Cache - Refactor with NetworkContext::ClearHttpCache
      • Get cache size - Refactor with NetworkContext::ComputeHttpCacheSize
    • Session::ClearHostResolverCache - Refactor with NetworkContext::ClearHostCache
    • Session::ClearAuthCache - Refactor with NetworkContext::ClearHttpAuthCache
    • Session::SetUserAgent - No interface available, this is worth patching in upstream
    • Session::AllowNTLMCredentialsForDomains - No interface available in network_context.mojom to modify this dynamically, however we do provide a chance to customize it during network context creation as part of NetworkContextParams, investigate benefit of this dynamic api to patch the interface and proposing a fix in upstream.
    • Session::SetCertVerifyProc - No interface available for the same reasons mentioned above.
  • The following apis that manipulate cookies must first retrieve the cookie manager using NetworkContext::GetCookieManager and use the interfaces defined in cookie_manager.mojom
  1. Cookies Module (Assigned: @nornagon)

    • Cookies::Get - Refactor with CookieManager::GetCookieList
    • Cookies::Remove - Refactor with CookieManager::DeleteCookies
    • Cookies::Set - Refactor with CookieManager::SetCanonicalCookie
    • Cookies::FlushStore - Refactor with CookieManager::FlushCookieStore
    • allow custom cookie schemes this doesn't work properly in the pre-network-service code, so no urgent need to support it in the new code.
  2. WebRequest Module (Assigned: @zcbenz )

  3. Protocol Module (Assigned: @zcbenz) - Preferred migration route

    • Register/Intercept APIs
    • protocol.registerSchemesAsPrivileged
  4. Net Module (Assigned: @zcbenz)

    • Use URLLoader instead of net::URLRequest
  5. net::URLRequestFetchJob special case

THIS WILL BE PART II , remaining refactors will followup.

@deepak1556
Copy link
Member Author

deepak1556 commented Mar 26, 2019

Couple more tasks at the end of Part II

  • verify graceful shutdown of the network service process. At the moment it isn't
[86722:0320/233317.511490:ERROR:message_pump_kqueue.cc(345)] StopWatchingFileDescriptor kevent64: No such file or directory (2)
[86719:0320/233317.541776:ERROR:browser_process_sub_thread.cc(210)] Waited 24 ms for network service
[86719:0320/233317.542885:WARNING:discardable_shared_memory_manager.cc(410)] Some MojoDiscardableSharedMemoryManagerImpls are still alive. They will be leaked.
[86719:0320/233317.554350:ERROR:process_posix.cc(330)] Unable to terminate process 86722: No such process (3)
[86719:0320/233317.556644:ERROR:message_pump_kqueue.cc(345)] StopWatchingFileDescriptor kevent64: No such file or directory (2)

Related bug: https://bugs.chromium.org/p/chromium/issues/detail?id=820996

kiku-jw pushed a commit to kiku-jw/electron that referenced this issue May 16, 2019
@deepak1556
Copy link
Member Author

Now that network service is enabled by default on all platforms in chrome, the old code path is being deleted. https://bugs.chromium.org/p/chromium/issues/detail?id=934009 is the tracking bug for it.

@deepak1556
Copy link
Member Author

Service is on by default on master, #19602 has followup tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant