Don't reference RequestContextGetter in JS objects

V8 doesn't guarrentee the C++ class of JS objects will get destroyed, so
this will result in RequestContextGetter never getting freed
This commit is contained in:
Cheng Zhao 2015-09-09 19:27:28 +08:00
parent 9d51da505e
commit 93bbc0bca9
3 changed files with 7 additions and 7 deletions

View file

@ -66,7 +66,7 @@ class Protocol : public mate::Wrappable {
public:
CustomProtocolHandler(
v8::Isolate* isolate,
scoped_refptr<net::URLRequestContextGetter> request_context,
net::URLRequestContextGetter* request_context,
const Handler& handler)
: isolate_(isolate),
request_context_(request_context),
@ -83,7 +83,7 @@ class Protocol : public mate::Wrappable {
private:
v8::Isolate* isolate_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
net::URLRequestContextGetter* request_context_;
Protocol::Handler handler_;
DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler);
@ -172,7 +172,7 @@ class Protocol : public mate::Wrappable {
// Convert error code to string.
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.
using OriginalProtocolsMap = base::ScopedPtrHashMap<