diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-27 13:59:30 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-27 13:59:30 +0000 |
commit | c2797431b41c6338f2ff7c2748ef8252782e2952 (patch) | |
tree | 334a513655355d12960f6393afe8957a574c6153 /net/proxy | |
parent | ba1e49d0c4cc60838b8bf315a1b715105b509569 (diff) | |
download | chromium_src-c2797431b41c6338f2ff7c2748ef8252782e2952.zip chromium_src-c2797431b41c6338f2ff7c2748ef8252782e2952.tar.gz chromium_src-c2797431b41c6338f2ff7c2748ef8252782e2952.tar.bz2 |
Make ProxyResolver not use to-be-deprecated V8 functions.
This gets rid of more places where Persistent handles are copied
(see bug).
BUG=236290
TBR=eroman@chromium.org
Review URL: https://chromiumcodereview.appspot.com/15796006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/proxy_resolver_v8.cc | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index c947250..2c340e7 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -351,9 +351,11 @@ class ProxyResolverV8::Context { int ResolveProxy(const GURL& query_url, ProxyInfo* results) { v8::Locker locked(isolate_); - v8::HandleScope scope; + v8::HandleScope scope(isolate_); - v8::Context::Scope function_scope(v8_context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, v8_context_); + v8::Context::Scope function_scope(context); v8::Local<v8::Value> function; if (!GetFindProxyForURL(&function)) { @@ -369,7 +371,7 @@ class ProxyResolverV8::Context { v8::TryCatch try_catch; v8::Local<v8::Value> ret = v8::Function::Cast(*function)->Call( - v8_context_->Global(), arraysize(argv), argv); + context->Global(), arraysize(argv), argv); if (try_catch.HasCaught()) { HandleError(try_catch.Message()); @@ -402,52 +404,56 @@ class ProxyResolverV8::Context { int InitV8(const scoped_refptr<ProxyResolverScriptData>& pac_script) { v8::Locker locked(isolate_); - v8::HandleScope scope; + v8::HandleScope scope(isolate_); v8_this_.Reset(isolate_, v8::External::New(this)); + v8::Local<v8::External> v8_this = + v8::Local<v8::External>::New(isolate_, v8_this_); v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); // Attach the javascript bindings. v8::Local<v8::FunctionTemplate> alert_template = - v8::FunctionTemplate::New(&AlertCallback, v8_this_); + v8::FunctionTemplate::New(&AlertCallback, v8_this); global_template->Set(ASCIILiteralToV8String("alert"), alert_template); v8::Local<v8::FunctionTemplate> my_ip_address_template = - v8::FunctionTemplate::New(&MyIpAddressCallback, v8_this_); + v8::FunctionTemplate::New(&MyIpAddressCallback, v8_this); global_template->Set(ASCIILiteralToV8String("myIpAddress"), my_ip_address_template); v8::Local<v8::FunctionTemplate> dns_resolve_template = - v8::FunctionTemplate::New(&DnsResolveCallback, v8_this_); + v8::FunctionTemplate::New(&DnsResolveCallback, v8_this); global_template->Set(ASCIILiteralToV8String("dnsResolve"), dns_resolve_template); // Microsoft's PAC extensions: v8::Local<v8::FunctionTemplate> dns_resolve_ex_template = - v8::FunctionTemplate::New(&DnsResolveExCallback, v8_this_); + v8::FunctionTemplate::New(&DnsResolveExCallback, v8_this); global_template->Set(ASCIILiteralToV8String("dnsResolveEx"), dns_resolve_ex_template); v8::Local<v8::FunctionTemplate> my_ip_address_ex_template = - v8::FunctionTemplate::New(&MyIpAddressExCallback, v8_this_); + v8::FunctionTemplate::New(&MyIpAddressExCallback, v8_this); global_template->Set(ASCIILiteralToV8String("myIpAddressEx"), my_ip_address_ex_template); v8::Local<v8::FunctionTemplate> sort_ip_address_list_template = - v8::FunctionTemplate::New(&SortIpAddressListCallback, v8_this_); + v8::FunctionTemplate::New(&SortIpAddressListCallback, v8_this); global_template->Set(ASCIILiteralToV8String("sortIpAddressList"), sort_ip_address_list_template); v8::Local<v8::FunctionTemplate> is_in_net_ex_template = - v8::FunctionTemplate::New(&IsInNetExCallback, v8_this_); + v8::FunctionTemplate::New(&IsInNetExCallback, v8_this); global_template->Set(ASCIILiteralToV8String("isInNetEx"), is_in_net_ex_template); v8_context_.Reset( isolate_, v8::Context::New(isolate_, NULL, global_template)); - v8::Context::Scope ctx(v8_context_); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(isolate_, v8_context_); + v8::Context::Scope ctx(context); // Add the PAC utility functions to the environment. // (This script should never fail, as it is a string literal!) @@ -486,8 +492,10 @@ class ProxyResolverV8::Context { private: bool GetFindProxyForURL(v8::Local<v8::Value>* function) { - *function = v8_context_->Global()->Get( - ASCIILiteralToV8String("FindProxyForURL")); + v8::Local<v8::Context> context = + v8::Local<v8::Context>::New(v8::Isolate::GetCurrent(), v8_context_); + *function = + context->Global()->Get(ASCIILiteralToV8String("FindProxyForURL")); return (*function)->IsFunction(); } |