Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/net/system_network_context_manager.h

Issue 2968293002: Introduce SystemNetworkContextManager. (Closed)
Patch Set: Fix windows non-component build (??) Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
6 #define CHROME_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
7
8 #include <memory>
9
10 #include "base/lazy_instance.h"
11 #include "base/macros.h"
12 #include "content/public/common/network_service.mojom.h"
13
14 // Global object that lives on the UI thread. Responsible for creating and
15 // managing access to the system NetworkContext. This NetworkContext is intended
16 // for requests not associated with a profile. It stores no data on disk, and
17 // has no HTTP cache, but it does have ephemeral cookie and channel ID stores.
18 // It also does not have access to HTTP proxy auth information the user has
19 // entered or that comes from extensions, and similarly, has no
20 // extension-provided per-profile proxy configuration information.
21 //
22 // The "system" NetworkContext will either share a URLRequestContext with
23 // IOThread's SystemURLRequestContext (If the OOP NetworkService is disabled) or
jam 2017/07/08 01:30:08 nit: here and below, I think OOP is not necessary
mmenke 2017/07/10 15:52:22 I've removed all instances of OOP (I now refer to
24 // be an independent NetworkContext in the OOP NetworkService.
25 //
26 // This class is intended to eventually replace IOThread. Handling the two cases
27 // differently allows this to be used in production without breaking anything or
28 // requiring two separate paths, while IOThread consumers slowly transition over
29 // to being compatible with an OOP NetworkService.
30 class SystemNetworkContextManager {
31 public:
32 // Initializes |network_context_params| as needed to set up a system
33 // NetworkContext. If the OOP NetworkService is disabled,
34 // |network_context_request| will be for the NetworkContext used by the
35 // SystemNetworkContextManager. Otherwise, this method can still be used to
36 // help set up the IOTHread's in-process URLRequestContext, and
37 // |network_context_request| will still be populated, but the associated
38 // NetworkContext will not be used by the SystemNetworkContextManager.
39 //
40 // Must be called before the system NetworkContext is first used.
41 static void SetUp(
42 content::mojom::NetworkContextRequest* network_context_request,
43 content::mojom::NetworkContextParamsPtr* network_context_params);
44
45 // Returns the System NetworkContext. May only be called after Initialize().
kinuko 2017/07/10 08:10:33 Wasn't sure what this Initialize points to, do you
mmenke 2017/07/10 15:52:22 Done, thanks (Renamed the method itself once I mov
46 static content::mojom::NetworkContext* Context();
47
48 private:
49 static SystemNetworkContextManager* GetInstance();
50
51 friend struct base::LazyInstanceTraitsBase<SystemNetworkContextManager>;
52
53 SystemNetworkContextManager();
54 ~SystemNetworkContextManager();
55
56 // Gets the system NetworkContext, creating it if needed.
57 content::mojom::NetworkContext* GetContext();
58
59 // The NetworkContext used by the |SystemNetworkContextManager|. If the OOP
60 // NetworkService is enabled, it's a NetworkContext using that NetworkService.
61 // If it's not enabled, it's a NetworkContext wrapping the IOThread's
62 // SystemURLRequestContext.
63 content::mojom::NetworkContextPtr system_network_context_;
64
65 // When the OOP NetworkService is enabled, this is a NetworkContext that wraps
66 // the IOThread's SystemURLRequestContext, and is never used after
67 // initialization. It's nullptr, otherwise.
68 content::mojom::NetworkContextPtr io_thread_network_context_;
69
70 DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager);
71 };
72
73 #endif // CHROME_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698