Lines Matching +full:- +full:- +full:network
3 This document gives an overview of the browser's lower-layers for networking.
9 [Network Service](../../services/network/README.md), and focuses on all the
10 layers below the Network Service, including key points of integration.
12 It's particularly targeted at people new to the Chrome network stack, but
16 network stack, and then moves on to discuss how various components plug in.
22 # Anatomy of the Network Stack
24 The network stack is located in //net/ in the Chrome repo, and uses the
28 The top-level network stack object is the URLRequestContext. The context has
29 non-owning pointers to everything needed to create and issue a URLRequest. The
35 by direct consumers of the network stack. It manages loading URLs with the
42 The HttpNetworkSession is another major network stack object. It owns the
44 also has non-owning pointers to the network stack objects that more directly
65 # The Network Service and Mojo
67 The network service, which lives in //services/network/, wraps //net/ objects,
68 and provides cross-process network APIs and their implementations for the rest
69 of Chrome. The network service uses the namespace "network" for all its classes.
70 The Mojo interfaces it provides are in the network::mojom namespace. Mojo is
71 Chrome's IPC layer. Generally there's a `mojo::Remote<network::mojom::Foo>`
73 the network::mojom::Foo interface. When the proxy object's methods are invoked,
75 `mojo::Receiver<network::mojom::Foo>`, to an implementation of the
76 network::mojom::Foo interface in the network service (the implementation is
77 typically a class named network::Foo), which may be running in another process,
81 The network::NetworkService object is singleton that is used by Chrome to create
82 all other network service objects. The primary objects it is used to create are
83 the network::NetworkContexts, each of which owns its own mostly independent
91 particular user or Profile. It has no on-disk storage, so loses all state, like
92 cookies, after each browser restart. It has no in-memory http cache, either.
93 SystemNetworkContextManager also sets up global network service preferences.
96 their own on-disk store, which includes cookies and an HTTP cache, among other
101 on-disk data, depending on the Profile and the App.
107 a network::URLLoader in the network service (which, on desktop platform, is
109 drive the network request. That job first checks the HTTP cache, and then
110 creates a network transaction object, if necessary, to actually fetch the data.
116 Of course, it's not quite that simple :-}.
118 Consider a simple request issued by some process other than the network
126 ### Request starts in some (non-network) process
130 * In the browser process, the network::mojom::NetworkContext interface is used
131 to create a network::mojom::URLLoaderFactory.
134 network::SimpleURLLoader) passes a network::ResourceRequest object and
135 network::mojom::URLLoaderClient Mojo channel to the
136 network::mojom::URLLoaderFactory, and tells it to create and start a
137 network::mojom::URLLoader.
138 * Mojo sends the network::ResourceRequest over an IPC pipe to a
139 network::URLLoaderFactory in the network process.
143 child processes, which are generally sandboxed and have no network access
144 themselves, apart from the network service (Which either runs in its own
146 multiple types of child processes (renderer, GPU, plugin, network, etc). The
149 The browser process creates the top level network::mojom::NetworkContext
152 network::mojom::URLLoaderFactories, which can then be passed to less
154 To create a URLLoaderFactory, a network::mojom::URLLoaderFactoryParams object
160 [privacy sandbox](https://www.chromium.org/Home/chromium-privacy/privacy-sandbox)
161 in the network stack, separating network resources used by different sites in
164 cookies for. SameSite cookies prevent cross-site attacks by only being
165 accessible when that site is the top-level site.
169 make a network request gets a URLLoaderFactory from the browser process through
171 network::ResourceRequest object, creates a network::mojom::URLLoaderClient Mojo
172 channel for the network::mojom::URLLoader to use to talk back to it, and then
174 it can use to manage the network request.
176 ### network::URLLoaderFactory sets up the request in the network service
180 * network::URLLoaderFactory creates a network::URLLoader.
181 * network::URLLoader uses the network::NetworkContext's URLRequestContext to
184 The network::URLLoaderFactory, along with all NetworkContexts and most of the
185 network stack, lives on a single thread in the network service. It gets a
186 reconstituted ResourceRequest object from the network::mojom::URLLoaderFactory
192 create the URLRequest. The URLRequestContext has pointers to all the network
193 stack objects needed to issue the request over the network, such as the cache,
195 network::ResourceScheduler, which may delay starting the request, based on
214 (historically, non-network URL schemes were also disptched through the
215 network stack, so there were a variety of job types.) The
274 network::URLLoader.
275 * They're then sent to the network::mojom::URLLoaderClient via Mojo.
285 to the URLRequest and on to the network::URLLoader, which sends the data over
286 a Mojo pipe to the network::mojom::URLLoaderClient, passed in to the URLLoader
293 * network::URLLoader creates a raw Mojo data pipe, and passes one end to the
294 network::mojom::URLLoaderClient.
300 Without waiting to hear back from the network::mojom::URLLoaderClient, the
301 network::URLLoader allocates a raw mojo data pipe, and passes the client the
315 * When complete, the network::URLLoaderFactory deletes the network::URLLoader,
320 When the URLRequest informs the network::URLLoader the request is complete, the
321 URLLoader passes the message along to the network::mojom::URLLoaderClient, over
348 that pointed-to HttpTransaction generally is an
359 sending a conditional revalidation request over the network. It may also break a
360 range request into multiple cached and non-cached contiguous chunks, and may
361 issue multiple network requests for a single range URLRequest.
375 It's also worth noting that each renderer process also has its own in-memory
377 the network service.
382 network::mojom::URLLoader pipe used by the request. This will cause the
383 network::URLLoader to destroy itself and its URLRequest.
404 followed. The URLRequest then informs the network::URLLoader about the redirect,
405 which passes information about the redirect to network::mojom::URLLoaderClient,
410 URLLoader over the network::mojom::URLLoader Mojo interface, which tells the
413 cancel the request instead, it can delete the network::mojom::URLLoader
420 the request and then calls into some other network::mojom::URLLoaderFactory
426 Content-Encoding values to Filter::Factory, which creates a (possibly empty)
450 The ClientSocketPoolBase handles managing sockets - which requests to create
488 ClientSocketPoolBaseHelper, which contains all the type-independent
498 Internally, that object is wrapped in a type-unsafe wrapper
501 allows the helper to create connect jobs while preserving a type-safe
521 their own exclusive TransportSocketPool, their own protocol-specific pool above
555 with an "Alternate-Protocol" HTTP header in their responses.
574 low priority requests on a per-tab basis.
580 * HTTP/2 and QUIC both support sending priorities over-the-wire.
588 ## Non-HTTP Schemes
592 is used as a full-duplex communication channel to the server for WebSocket
598 Other schemes typically have their own network::mojom::URLLoaderFactory that
599 is not part of the network service. Standard schemes like file:// and blob://
602 for those two schemes). Chrome-specific schemes, like externalfile:// and
603 chrome-extension:// are often handled by a URLLoaderFactory in the chrome layer,
608 internally, as sending it to an out-of-process URLLoader would be inefficient.
613 mojo::Remote for the browser-hosted URLLoader is passed to a renderer