electron/atom/browser/io_thread.h
Electron Bot d008d217f9 chore: bump chromium to 2a7aff41ce73adc0eeee67d364989 (master) (#18505)
* chore: bump chromium in DEPS to 07463d3cd628b037c11f36022cb4c788db4628e3

* chore: update patches

* fix: Don't leak system network context when nw service is disabled

https://chromium-review.googlesource.com/c/chromium/src/+/1632494
NetworkService is now deleted by using SequnceLocalStorageSlot
on the IO thread when the service is disabled, which expects
all associated NetworkContexts on that sequence to be destroyed.

* chore: bump chromium in DEPS to 7c16850e7e40990e141f47101b737ec1092175a1

* fix: Destroy all network contexts before primary network context

* Simplify out-of-process service registration

https://chromium-review.googlesource.com/c/chromium/src/+/1615882

* [ThreadPool] Rename base::ThreadPool to base::ThreadPoolInstance

https://chromium-review.googlesource.com/c/chromium/src/+/1634851

* chore: update patches

* fix: -Winconsistent-missing-override warnings

* chore: bump chromium in DEPS to 93ebfaccc12715df1d5426797998eed0932f7ae1

* Change CreateBrowserMainParts to return unique_ptrs

https://chromium-review.googlesource.com/c/chromium/src/+/1632532

* chore: update patches

* chore: bump chromium in DEPS to e656555ffb87bdd05e248d0a3ef9dd9d3433e17b

* chore: bump chromium in DEPS to 111e7a8d2e3ae9d70e535009d6afb066ac906063

* chore: bump chromium in DEPS to 9b6b84670d32a7aff41ce73adc0eeee67d364989

* chore: update patches

* chore: remove ShouldInterceptResourceAsStream as it is removed upstream

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1639597

* chore: remove ResourceDispatcherHostCreated as it is removed upstream

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1610892

* chore: CreateWithStrongBinding --> CreateWithSelfOwnedReceiver

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1636722

* chore: rename all blink media enums

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1639237

* chore: add accidentally removed patch content back
2019-06-03 20:44:12 -07:00

75 lines
2.5 KiB
C++

// Copyright (c) 2017 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_IO_THREAD_H_
#define ATOM_BROWSER_IO_THREAD_H_
#include <memory>
#include <set>
#include "atom/browser/net/system_network_context_manager.h"
#include "base/macros.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/browser_thread_delegate.h"
#include "services/network/public/mojom/network_service.mojom.h"
namespace atom {
class URLRequestContextGetter;
}
namespace net {
class URLRequestContext;
}
namespace net_log {
class ChromeNetLog;
}
class IOThread : public content::BrowserThreadDelegate {
public:
explicit IOThread(
net_log::ChromeNetLog* net_log,
SystemNetworkContextManager* system_network_context_manager);
~IOThread() override;
void RegisterURLRequestContextGetter(atom::URLRequestContextGetter* getter);
void DeregisterURLRequestContextGetter(atom::URLRequestContextGetter* getter);
protected:
// BrowserThreadDelegate Implementation, runs on the IO thread.
void Init() override;
void CleanUp() override;
private:
// The NetLog is owned by the browser process, to allow logging from other
// threads during shutdown, but is used most frequently on the IOThread.
net_log::ChromeNetLog* net_log_;
// When the network service is disabled, this holds on to a
// content::NetworkContext class that owns |system_request_context_|.
std::unique_ptr<network::mojom::NetworkContext> system_network_context_;
net::URLRequestContext* system_request_context_;
// These are set on the UI thread, and then consumed during initialization on
// the IO thread.
network::mojom::NetworkContextRequest network_context_request_;
network::mojom::NetworkContextParamsPtr network_context_params_;
// Initial HTTP auth configuration used when setting up the NetworkService on
// the IO Thread. Future updates are sent using the NetworkService mojo
// interface, but initial state needs to be set non-racily.
network::mojom::HttpAuthStaticParamsPtr http_auth_static_params_;
network::mojom::HttpAuthDynamicParamsPtr http_auth_dynamic_params_;
// |lock_| protects access to |request_context_getters_|.
base::Lock lock_;
// List of all request contexts that needs to be notified when
// IO thread is shutting down.
std::set<atom::URLRequestContextGetter*> request_context_getters_;
DISALLOW_COPY_AND_ASSIGN(IOThread);
};
#endif // ATOM_BROWSER_IO_THREAD_H_