fix: notify request context shutdown on IO before cleanup (#14058)
This commit is contained in:
parent
8c21762bee
commit
9989195f19
22 changed files with 504 additions and 387 deletions
|
@ -8,17 +8,15 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/callback_list.h"
|
||||
#include "brightray/browser/browser_context.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class AtomBlobReader;
|
||||
class AtomDownloadManagerDelegate;
|
||||
class AtomNetworkDelegate;
|
||||
class AtomPermissionManager;
|
||||
class RequestContextDelegate;
|
||||
class WebViewManager;
|
||||
struct CookieDetails;
|
||||
|
||||
class AtomBrowserContext : public brightray::BrowserContext {
|
||||
public:
|
||||
|
@ -31,24 +29,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
|||
const base::DictionaryValue& options = base::DictionaryValue());
|
||||
|
||||
void SetUserAgent(const std::string& user_agent);
|
||||
// Register callbacks that needs to notified on any cookie store changes.
|
||||
std::unique_ptr<base::CallbackList<void(const CookieDetails*)>::Subscription>
|
||||
RegisterCookieChangeCallback(
|
||||
const base::Callback<void(const CookieDetails*)>& cb);
|
||||
|
||||
// brightray::URLRequestContextGetter::Delegate:
|
||||
std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate() override;
|
||||
std::string GetUserAgent() override;
|
||||
std::unique_ptr<net::URLRequestJobFactory> CreateURLRequestJobFactory(
|
||||
content::ProtocolHandlerMap* protocol_handlers) override;
|
||||
net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory(
|
||||
const base::FilePath& base_path) override;
|
||||
std::unique_ptr<net::CertVerifier> CreateCertVerifier(
|
||||
brightray::RequireCTDelegate* ct_delegate) override;
|
||||
std::vector<std::string> GetCookieableSchemes() override;
|
||||
void NotifyCookieChange(const net::CanonicalCookie& cookie,
|
||||
bool removed,
|
||||
net::CookieChangeCause cause) override;
|
||||
AtomBlobReader* GetBlobReader();
|
||||
|
||||
// content::BrowserContext:
|
||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||
|
@ -57,14 +38,12 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
|||
|
||||
// brightray::BrowserContext:
|
||||
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
|
||||
std::string GetUserAgent() const override;
|
||||
void OnMainRequestContextCreated(
|
||||
brightray::URLRequestContextGetter* getter) override;
|
||||
|
||||
AtomBlobReader* GetBlobReader();
|
||||
|
||||
void set_cookie_change_subscription(
|
||||
std::unique_ptr<
|
||||
base::CallbackList<void(const CookieDetails*)>::Subscription>
|
||||
subscription) {
|
||||
cookie_change_subscription_.swap(subscription);
|
||||
RequestContextDelegate* GetRequestContextDelegate() const {
|
||||
return request_context_delegate_.get();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -74,16 +53,14 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
|||
~AtomBrowserContext() override;
|
||||
|
||||
private:
|
||||
brightray::URLRequestContextGetter* url_request_context_getter_;
|
||||
|
||||
std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
|
||||
std::unique_ptr<WebViewManager> guest_manager_;
|
||||
std::unique_ptr<AtomPermissionManager> permission_manager_;
|
||||
std::unique_ptr<AtomBlobReader> blob_reader_;
|
||||
std::unique_ptr<RequestContextDelegate> request_context_delegate_;
|
||||
std::string user_agent_;
|
||||
bool use_cache_;
|
||||
|
||||
base::CallbackList<void(const CookieDetails*)> cookie_change_sub_list_;
|
||||
std::unique_ptr<base::CallbackList<void(const CookieDetails*)>::Subscription>
|
||||
cookie_change_subscription_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue