| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/proxy/proxy_resolver_v8.h" | 5 #include "net/proxy/proxy_resolver_v8.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdio> | 8 #include <cstdio> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 415 } |
| 416 | 416 |
| 417 int InitV8(const scoped_refptr<ProxyResolverScriptData>& pac_script) { | 417 int InitV8(const scoped_refptr<ProxyResolverScriptData>& pac_script) { |
| 418 v8::Locker locked(isolate_); | 418 v8::Locker locked(isolate_); |
| 419 v8::Isolate::Scope isolate_scope(isolate_); | 419 v8::Isolate::Scope isolate_scope(isolate_); |
| 420 v8::HandleScope scope(isolate_); | 420 v8::HandleScope scope(isolate_); |
| 421 | 421 |
| 422 v8_this_.Reset(isolate_, v8::External::New(isolate_, this)); | 422 v8_this_.Reset(isolate_, v8::External::New(isolate_, this)); |
| 423 v8::Local<v8::External> v8_this = | 423 v8::Local<v8::External> v8_this = |
| 424 v8::Local<v8::External>::New(isolate_, v8_this_); | 424 v8::Local<v8::External>::New(isolate_, v8_this_); |
| 425 v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 425 v8::Local<v8::ObjectTemplate> global_template = |
| 426 v8::ObjectTemplate::New(isolate_); |
| 426 | 427 |
| 427 // Attach the javascript bindings. | 428 // Attach the javascript bindings. |
| 428 v8::Local<v8::FunctionTemplate> alert_template = | 429 v8::Local<v8::FunctionTemplate> alert_template = |
| 429 v8::FunctionTemplate::New(isolate_, &AlertCallback, v8_this); | 430 v8::FunctionTemplate::New(isolate_, &AlertCallback, v8_this); |
| 430 global_template->Set(ASCIILiteralToV8String(isolate_, "alert"), | 431 global_template->Set(ASCIILiteralToV8String(isolate_, "alert"), |
| 431 alert_template); | 432 alert_template); |
| 432 | 433 |
| 433 v8::Local<v8::FunctionTemplate> my_ip_address_template = | 434 v8::Local<v8::FunctionTemplate> my_ip_address_template = |
| 434 v8::FunctionTemplate::New(isolate_, &MyIpAddressCallback, v8_this); | 435 v8::FunctionTemplate::New(isolate_, &MyIpAddressCallback, v8_this); |
| 435 global_template->Set(ASCIILiteralToV8String(isolate_, "myIpAddress"), | 436 global_template->Set(ASCIILiteralToV8String(isolate_, "myIpAddress"), |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 return 0; | 825 return 0; |
| 825 | 826 |
| 826 v8::Locker locked(g_default_isolate_); | 827 v8::Locker locked(g_default_isolate_); |
| 827 v8::Isolate::Scope isolate_scope(g_default_isolate_); | 828 v8::Isolate::Scope isolate_scope(g_default_isolate_); |
| 828 v8::HeapStatistics heap_statistics; | 829 v8::HeapStatistics heap_statistics; |
| 829 g_default_isolate_->GetHeapStatistics(&heap_statistics); | 830 g_default_isolate_->GetHeapStatistics(&heap_statistics); |
| 830 return heap_statistics.used_heap_size(); | 831 return heap_statistics.used_heap_size(); |
| 831 } | 832 } |
| 832 | 833 |
| 833 } // namespace net | 834 } // namespace net |
| OLD | NEW |