Skip to content

Commit 67b61c4

Browse files
committed
Remove the old network implementation (see issue #2622)
The `--disable-features=NetworkService` flag is no longer supported.
1 parent ccb06ce commit 67b61c4

76 files changed

Lines changed: 281 additions & 6098 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD.gn

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -371,37 +371,15 @@ static_library("libcef_static") {
371371
"libcef/browser/navigate_params.h",
372372
"libcef/browser/navigation_entry_impl.cc",
373373
"libcef/browser/navigation_entry_impl.h",
374-
"libcef/browser/net/browser_urlrequest_old_impl.cc",
375-
"libcef/browser/net/browser_urlrequest_old_impl.h",
376374
"libcef/browser/net/chrome_scheme_handler.cc",
377375
"libcef/browser/net/chrome_scheme_handler.h",
378-
"libcef/browser/net/cookie_manager_old_impl.cc",
379-
"libcef/browser/net/cookie_manager_old_impl.h",
380376
"libcef/browser/net/crlset_file_util_impl.cc",
381377
"libcef/browser/net/devtools_scheme_handler.cc",
382378
"libcef/browser/net/devtools_scheme_handler.h",
383379
"libcef/browser/net/internal_scheme_handler.cc",
384380
"libcef/browser/net/internal_scheme_handler.h",
385-
"libcef/browser/net/net_util.cc",
386-
"libcef/browser/net/net_util.h",
387-
"libcef/browser/net/network_delegate.cc",
388-
"libcef/browser/net/network_delegate.h",
389-
"libcef/browser/net/resource_request_job.cc",
390-
"libcef/browser/net/resource_request_job.h",
391381
"libcef/browser/net/scheme_handler.cc",
392382
"libcef/browser/net/scheme_handler.h",
393-
"libcef/browser/net/source_stream.cc",
394-
"libcef/browser/net/source_stream.h",
395-
"libcef/browser/net/url_request_context.cc",
396-
"libcef/browser/net/url_request_context.h",
397-
"libcef/browser/net/url_request_context_getter.cc",
398-
"libcef/browser/net/url_request_context_getter.h",
399-
"libcef/browser/net/url_request_interceptor.cc",
400-
"libcef/browser/net/url_request_interceptor.h",
401-
"libcef/browser/net/url_request_manager.cc",
402-
"libcef/browser/net/url_request_manager.h",
403-
"libcef/browser/net/url_request_user_data.cc",
404-
"libcef/browser/net/url_request_user_data.h",
405383
"libcef/browser/net_service/browser_urlrequest_impl.cc",
406384
"libcef/browser/net_service/browser_urlrequest_impl.h",
407385
"libcef/browser/net_service/cookie_helper.cc",
@@ -462,8 +440,6 @@ static_library("libcef_static") {
462440
"libcef/browser/process_util_impl.cc",
463441
"libcef/browser/resource_context.cc",
464442
"libcef/browser/resource_context.h",
465-
"libcef/browser/resource_dispatcher_host_delegate.cc",
466-
"libcef/browser/resource_dispatcher_host_delegate.h",
467443
"libcef/browser/request_context_impl.cc",
468444
"libcef/browser/request_context_impl.h",
469445
"libcef/browser/scheme_impl.cc",
@@ -538,8 +514,6 @@ static_library("libcef_static") {
538514
"libcef/common/net/upload_element.h",
539515
"libcef/common/net_service/net_service_util.cc",
540516
"libcef/common/net_service/net_service_util.h",
541-
"libcef/common/net_service/util.cc",
542-
"libcef/common/net_service/util.h",
543517
"libcef/common/parser_impl.cc",
544518
"libcef/common/process_message_impl.cc",
545519
"libcef/common/process_message_impl.h",

libcef/browser/browser_context.cc

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "libcef/browser/thread_util.h"
1818
#include "libcef/common/cef_switches.h"
1919
#include "libcef/common/extensions/extensions_util.h"
20-
#include "libcef/common/net_service/util.h"
2120

2221
#include "base/command_line.h"
2322
#include "base/files/file_util.h"
@@ -245,7 +244,7 @@ CefBrowserContext::~CefBrowserContext() {
245244

246245
if (resource_context_.get()) {
247246
// Destruction of the ResourceContext will trigger destruction of all
248-
// associated URLRequests.
247+
// associated network requests.
249248
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
250249
resource_context_.release());
251250
}
@@ -258,8 +257,6 @@ CefBrowserContext::~CefBrowserContext() {
258257

259258
pref_proxy_config_tracker_->DetachFromPrefService();
260259

261-
if (url_request_getter_)
262-
url_request_getter_->ShutdownOnUIThread();
263260
if (host_content_settings_map_)
264261
host_content_settings_map_->ShutdownOnUIThread();
265262

@@ -352,15 +349,6 @@ void CefBrowserContext::Initialize() {
352349

353350
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
354351
this, resource_context_.get());
355-
356-
if (!net_service::IsEnabled()) {
357-
// Create the CefURLRequestContextGetter via an indirect call to
358-
// CreateRequestContext. Triggers a call to CefURLRequestContextGetter::
359-
// GetURLRequestContext() on the IO thread which creates the
360-
// CefURLRequestContext.
361-
GetRequestContext();
362-
DCHECK(url_request_getter_.get());
363-
}
364352
}
365353

366354
void CefBrowserContext::AddCefRequestContext(CefRequestContextImpl* context) {
@@ -410,9 +398,8 @@ CefBrowserContext::GetClientHintsControllerDelegate() {
410398
}
411399

412400
net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() {
413-
CEF_REQUIRE_UIT();
414-
DCHECK(!net_service::IsEnabled());
415-
return GetDefaultStoragePartition(this)->GetURLRequestContext();
401+
NOTREACHED() << "NetworkService is required";
402+
return nullptr;
416403
}
417404

418405
net::URLRequestContextGetter* CefBrowserContext::CreateMediaRequestContext() {
@@ -519,37 +506,8 @@ CefBrowserContext::GetBrowsingDataRemoverDelegate() {
519506
net::URLRequestContextGetter* CefBrowserContext::CreateRequestContext(
520507
content::ProtocolHandlerMap* protocol_handlers,
521508
content::URLRequestInterceptorScopedVector request_interceptors) {
522-
CEF_REQUIRE_UIT();
523-
DCHECK(!net_service::IsEnabled());
524-
DCHECK(!url_request_getter_.get());
525-
526-
auto io_thread_runner =
527-
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO});
528-
529-
// Initialize the proxy configuration service.
530-
// TODO(cef): Determine if we can use the Chrome/Mojo implementation from
531-
// https://crrev.com/d0d0d050
532-
std::unique_ptr<net::ProxyConfigService> base_service(
533-
net::ProxyResolutionService::CreateSystemProxyConfigService(
534-
io_thread_runner));
535-
std::unique_ptr<net::ProxyConfigService> proxy_config_service(
536-
pref_proxy_config_tracker_->CreateTrackingProxyConfigService(
537-
std::move(base_service)));
538-
539-
if (extensions::ExtensionsEnabled()) {
540-
// Handle only chrome-extension:// requests. CEF does not support
541-
// chrome-extension-resource:// requests (it does not store shared extension
542-
// data in its installation directory).
543-
extensions::InfoMap* extension_info_map = extension_system()->info_map();
544-
(*protocol_handlers)[extensions::kExtensionScheme] =
545-
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
546-
extension_info_map);
547-
}
548-
549-
url_request_getter_ = new CefURLRequestContextGetter(
550-
settings_, GetPrefs(), io_thread_runner, protocol_handlers,
551-
std::move(proxy_config_service), std::move(request_interceptors));
552-
return url_request_getter_.get();
509+
NOTREACHED() << "NetworkService is required";
510+
return nullptr;
553511
}
554512

555513
net::URLRequestContextGetter*
@@ -742,7 +700,6 @@ void CefBrowserContext::ClearSchemeHandlerFactories() {
742700

743701
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
744702
CEF_REQUIRE_UIT();
745-
DCHECK(net_service::IsEnabled());
746703
return GetDefaultStoragePartition(this)->GetNetworkContext();
747704
}
748705

libcef/browser/browser_context.h

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "include/cef_request_context_handler.h"
1010
#include "libcef/browser/chrome_profile_stub.h"
11-
#include "libcef/browser/net/url_request_context_getter.h"
1211
#include "libcef/browser/resource_context.h"
1312

1413
#include "base/files/file_path.h"
@@ -47,33 +46,23 @@
4746
// controlled indirectly by BC.
4847
//
4948
// RC = CefResourceContext
50-
// Acts as a bridge for resource loading. URLRequest life span is tied to this
51-
// object. Must be destroyed before the associated URCG. Life span is
49+
// Acts as a bridge for resource loading. Network request life span is tied to
50+
// this object. Must be destroyed before the associated URCG. Life span is
5251
// controlled by BC.
5352
//
54-
// URCG = CefURLRequestContextGetter
55-
// Creates and owns the URC. Created by StoragePartitionImplMap::Get()
56-
// calling BC::CreateRequestContext(). Life span is controlled by RC and (for
57-
// the global context) CefBrowserMainParts, and SPI.
58-
//
59-
// URC = CefURLRequestContext
60-
// Owns various network-related objects including the isolated cookie manager.
61-
// Owns URLRequest objects which must be destroyed first. Life span is
62-
// controlled by URCG.
63-
//
6453
//
6554
// Relationship diagram:
6655
// ref = reference (CefRefPtr/scoped_refptr)
6756
// own = ownership (std::unique_ptr)
6857
// ptr = raw pointer
6958
//
70-
// CefBrowserMainParts--\ isolated cookie manager, etc.
71-
// | \ ^
72-
// own ref ref/own
73-
// v v |
74-
// BHI -own-> WC -ptr-> BC -own-> SPI -ref-> URCG --own-> URC
59+
// CefBrowserMainParts
60+
// |
61+
// own
62+
// v
63+
// BHI -own-> WC -ptr-> BC -own-> SPI
7564
//
76-
// BHI -ref-> RCI -own-> BC -own-> RC -ref-> URCG
65+
// BHI -ref-> RCI -own-> BC -own-> RC
7766
//
7867
//
7968
// How shutdown works:
@@ -86,13 +75,7 @@
8675
// CefBrowserMainParts::PostMainMessageLoopRun().
8776
// 4. CefResourceContext is destroyed asynchronously on the IO thread due to
8877
// CefBrowserContext destruction. This cancels/destroys any pending
89-
// URLRequests.
90-
// 5. CefURLRequestContextGetter is destroyed asynchronously on the IO thread
91-
// due to CefResourceContext destruction (or ref release in
92-
// CefBrowserMainParts::PostMainMessageLoopRun. This may be delayed if other
93-
// network-related objects still have a reference to it.
94-
// 6. CefURLRequestContext is destroyed on the IO thread due to
95-
// CefURLRequestContextGetter destruction.
78+
// network requests.
9679
*/
9780

9881
class CefDownloadManagerDelegate;
@@ -256,11 +239,6 @@ class CefBrowserContext : public ChromeProfileStub,
256239
return extension_system_;
257240
}
258241

259-
// Guaranteed to exist once this object has been initialized.
260-
scoped_refptr<CefURLRequestContextGetter> request_context_getter() const {
261-
return url_request_getter_;
262-
}
263-
264242
// Called from DownloadPrefs::FromBrowserContext.
265243
DownloadPrefs* GetDownloadPrefs();
266244

@@ -284,7 +262,6 @@ class CefBrowserContext : public ChromeProfileStub,
284262
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
285263

286264
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
287-
scoped_refptr<CefURLRequestContextGetter> url_request_getter_;
288265
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
289266
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
290267
std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;

libcef/browser/browser_main.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "libcef/common/extensions/extensions_client.h"
2323
#include "libcef/common/extensions/extensions_util.h"
2424
#include "libcef/common/net/net_resource_provider.h"
25-
#include "libcef/common/net_service/util.h"
2625

2726
#include "base/bind.h"
2827
#include "base/message_loop/message_loop.h"
@@ -128,12 +127,10 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
128127
#endif
129128

130129
#if defined(OS_MACOSX)
131-
if (net_service::IsEnabled()) {
132-
// Initialize the OSCrypt.
133-
PrefService* local_state = g_browser_process->local_state();
134-
DCHECK(local_state);
135-
OSCrypt::Init(local_state);
136-
}
130+
// Initialize the OSCrypt.
131+
PrefService* local_state = g_browser_process->local_state();
132+
DCHECK(local_state);
133+
OSCrypt::Init(local_state);
137134
#endif
138135

139136
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
@@ -162,10 +159,7 @@ int CefBrowserMainParts::PreCreateThreads() {
162159
// Initialize these objects before IO access restrictions are applied and
163160
// before the IO thread is started.
164161
content::GpuDataManager::GetInstance();
165-
if (net_service::IsEnabled()) {
166-
SystemNetworkContextManager::CreateInstance(
167-
g_browser_process->local_state());
168-
}
162+
SystemNetworkContextManager::CreateInstance(g_browser_process->local_state());
169163

170164
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
171165
chrome_extra_parts_[i]->PreCreateThreads();

libcef/browser/browser_main.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
#define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_
77
#pragma once
88

9-
#include "libcef/browser/net/url_request_context_getter.h"
109
#include "libcef/browser/request_context_impl.h"
1110

1211
#include "base/macros.h"
1312
#include "base/strings/string_piece.h"
1413
#include "build/build_config.h"
1514
#include "components/prefs/pref_service.h"
1615
#include "content/public/browser/browser_main_parts.h"
17-
#include "net/url_request/url_request_context_getter.h"
1816

1917
namespace content {
2018
struct MainFunctionParams;

libcef/browser/chrome_browser_process_stub.cc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "libcef/browser/prefs/browser_prefs.h"
1212
#include "libcef/browser/thread_util.h"
1313
#include "libcef/common/cef_switches.h"
14-
#include "libcef/common/net_service/util.h"
1514

1615
#include "base/command_line.h"
1716
#include "chrome/browser/net/system_network_context_manager.h"
@@ -21,7 +20,6 @@
2120
#include "chrome/browser/printing/print_preview_dialog_controller.h"
2221
#include "chrome/browser/ui/prefs/pref_watcher.h"
2322
#include "components/net_log/chrome_net_log.h"
24-
#include "components/net_log/net_export_file_writer.h"
2523
#include "components/prefs/pref_service.h"
2624
#include "content/browser/startup_helper.h"
2725
#include "content/public/common/content_switches.h"
@@ -79,7 +77,7 @@ void ChromeBrowserProcessStub::Shutdown() {
7977
profile_manager_.reset();
8078
event_router_forwarder_ = nullptr;
8179

82-
if (net_service::IsEnabled() && SystemNetworkContextManager::GetInstance()) {
80+
if (SystemNetworkContextManager::GetInstance()) {
8381
SystemNetworkContextManager::DeleteInstance();
8482
}
8583

@@ -145,14 +143,6 @@ ChromeBrowserProcessStub::system_network_context_manager() {
145143
return SystemNetworkContextManager::GetInstance();
146144
}
147145

148-
net_log::NetExportFileWriter*
149-
ChromeBrowserProcessStub::net_export_file_writer() {
150-
if (!net_export_file_writer_) {
151-
net_export_file_writer_ = std::make_unique<net_log::NetExportFileWriter>();
152-
}
153-
return net_export_file_writer_.get();
154-
}
155-
156146
network::NetworkQualityTracker*
157147
ChromeBrowserProcessStub::network_quality_tracker() {
158148
NOTREACHED();

libcef/browser/chrome_browser_process_stub.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
4747
rappor::RapporServiceImpl* rappor_service() override;
4848
IOThread* io_thread() override;
4949
SystemNetworkContextManager* system_network_context_manager() override;
50-
net_log::NetExportFileWriter* net_export_file_writer() override;
5150
network::NetworkQualityTracker* network_quality_tracker() override;
5251
WatchDogThread* watchdog_thread() override;
5352
ProfileManager* profile_manager() override;
@@ -122,7 +121,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
122121
print_preview_dialog_controller_;
123122
std::unique_ptr<printing::BackgroundPrintingManager>
124123
background_printing_manager_;
125-
std::unique_ptr<net_log::NetExportFileWriter> net_export_file_writer_;
126124
std::unique_ptr<PrefService> local_state_;
127125
// Must be destroyed after |local_state_|.
128126
std::unique_ptr<policy::ChromeBrowserPolicyConnector>

libcef/browser/chrome_profile_stub.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ PrefService* ChromeProfileStub::GetOffTheRecordPrefs() {
7272

7373
base::OnceCallback<net::CookieStore*()>
7474
ChromeProfileStub::GetExtensionsCookieStoreGetter() {
75-
return base::BindOnce(
76-
[](scoped_refptr<net::URLRequestContextGetter> context) {
77-
return context->GetURLRequestContext()->cookie_store();
78-
},
79-
base::WrapRefCounted(GetRequestContext()));
75+
NOTREACHED();
76+
return base::OnceCallback<net::CookieStore*()>();
8077
}
8178

8279
bool ChromeProfileStub::IsSameProfile(Profile* profile) {

0 commit comments

Comments
 (0)