Merge pull request #2746 from atom/no-keep
Fix session not getting persisted on exit
This commit is contained in:
commit
749a1a3e9a
5 changed files with 18 additions and 9 deletions
|
@ -78,7 +78,7 @@ class Cookies : public mate::Wrappable {
|
||||||
// Must be called on IO thread.
|
// Must be called on IO thread.
|
||||||
net::CookieStore* GetCookieStore();
|
net::CookieStore* GetCookieStore();
|
||||||
|
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
net::URLRequestContextGetter* request_context_getter_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Cookies);
|
DISALLOW_COPY_AND_ASSIGN(Cookies);
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Protocol : public mate::Wrappable {
|
||||||
public:
|
public:
|
||||||
CustomProtocolHandler(
|
CustomProtocolHandler(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context,
|
net::URLRequestContextGetter* request_context,
|
||||||
const Handler& handler)
|
const Handler& handler)
|
||||||
: isolate_(isolate),
|
: isolate_(isolate),
|
||||||
request_context_(request_context),
|
request_context_(request_context),
|
||||||
|
@ -83,7 +83,7 @@ class Protocol : public mate::Wrappable {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_;
|
net::URLRequestContextGetter* request_context_;
|
||||||
Protocol::Handler handler_;
|
Protocol::Handler handler_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
|
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
|
||||||
|
@ -172,7 +172,7 @@ class Protocol : public mate::Wrappable {
|
||||||
// Convert error code to string.
|
// Convert error code to string.
|
||||||
std::string ErrorCodeToString(ProtocolError error);
|
std::string ErrorCodeToString(ProtocolError error);
|
||||||
|
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
net::URLRequestContextGetter* request_context_getter_;
|
||||||
|
|
||||||
// Map that stores the original protocols of schemes.
|
// Map that stores the original protocols of schemes.
|
||||||
using OriginalProtocolsMap = base::ScopedPtrHashMap<
|
using OriginalProtocolsMap = base::ScopedPtrHashMap<
|
||||||
|
|
|
@ -39,8 +39,6 @@ AtomBrowserMainParts::AtomBrowserMainParts()
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomBrowserMainParts::~AtomBrowserMainParts() {
|
AtomBrowserMainParts::~AtomBrowserMainParts() {
|
||||||
for (const auto& callback : destruction_callbacks_)
|
|
||||||
callback.Run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@ -118,4 +116,14 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomBrowserMainParts::PostMainMessageLoopRun() {
|
||||||
|
brightray::BrowserMainParts::PostMainMessageLoopRun();
|
||||||
|
|
||||||
|
// Make sure destruction callbacks are called before message loop is
|
||||||
|
// destroyed, otherwise some objects that need to be deleted on IO thread
|
||||||
|
// won't be freed.
|
||||||
|
for (const auto& callback : destruction_callbacks_)
|
||||||
|
callback.Run();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -41,6 +41,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
||||||
// content::BrowserMainParts:
|
// content::BrowserMainParts:
|
||||||
void PostEarlyInitialization() override;
|
void PostEarlyInitialization() override;
|
||||||
void PreMainMessageLoopRun() override;
|
void PreMainMessageLoopRun() override;
|
||||||
|
void PostMainMessageLoopRun() override;
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void PreMainMessageLoopStart() override;
|
void PreMainMessageLoopStart() override;
|
||||||
void PostDestroyThreads() override;
|
void PostDestroyThreads() override;
|
||||||
|
|
|
@ -46,7 +46,7 @@ class JsAsker : public RequestJob {
|
||||||
// Called by |CustomProtocolHandler| to store handler related information.
|
// Called by |CustomProtocolHandler| to store handler related information.
|
||||||
void SetHandlerInfo(
|
void SetHandlerInfo(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter,
|
net::URLRequestContextGetter* request_context_getter,
|
||||||
const JavaScriptHandler& handler) {
|
const JavaScriptHandler& handler) {
|
||||||
isolate_ = isolate;
|
isolate_ = isolate;
|
||||||
request_context_getter_ = request_context_getter;
|
request_context_getter_ = request_context_getter;
|
||||||
|
@ -57,7 +57,7 @@ class JsAsker : public RequestJob {
|
||||||
virtual void StartAsync(scoped_ptr<base::Value> options) = 0;
|
virtual void StartAsync(scoped_ptr<base::Value> options) = 0;
|
||||||
|
|
||||||
net::URLRequestContextGetter* request_context_getter() const {
|
net::URLRequestContextGetter* request_context_getter() const {
|
||||||
return request_context_getter_.get();
|
return request_context_getter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -89,7 +89,7 @@ class JsAsker : public RequestJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
net::URLRequestContextGetter* request_context_getter_;
|
||||||
JavaScriptHandler handler_;
|
JavaScriptHandler handler_;
|
||||||
|
|
||||||
base::WeakPtrFactory<JsAsker> weak_factory_;
|
base::WeakPtrFactory<JsAsker> weak_factory_;
|
||||||
|
|
Loading…
Add table
Reference in a new issue