| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/debug/leak_annotations.h" | 13 #include "base/debug/leak_annotations.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/strings/string_tokenizer.h" | 17 #include "base/strings/string_tokenizer.h" |
| 18 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" |
| 21 #include "gin/array_buffer.h" | 22 #include "gin/array_buffer.h" |
| 22 #include "gin/public/isolate_holder.h" | 23 #include "gin/public/isolate_holder.h" |
| 23 #include "gin/v8_initializer.h" | 24 #include "gin/v8_initializer.h" |
| 24 #include "net/base/ip_address.h" | 25 #include "net/base/ip_address.h" |
| 25 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
| 26 #include "net/proxy/proxy_info.h" | 27 #include "net/proxy/proxy_info.h" |
| 27 #include "net/proxy/proxy_resolver_script.h" | 28 #include "net/proxy/proxy_resolver_script.h" |
| 28 #include "net/proxy/proxy_resolver_script_data.h" | 29 #include "net/proxy/proxy_resolver_script_data.h" |
| 29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 30 #include "url/url_canon.h" | 31 #include "url/url_canon.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 v8::V8::SetFlagsFromString(kNoOpt, strlen(kNoOpt)); | 385 v8::V8::SetFlagsFromString(kNoOpt, strlen(kNoOpt)); |
| 385 | 386 |
| 386 gin::IsolateHolder::Initialize( | 387 gin::IsolateHolder::Initialize( |
| 387 gin::IsolateHolder::kNonStrictMode, | 388 gin::IsolateHolder::kNonStrictMode, |
| 388 gin::IsolateHolder::kStableV8Extras, | 389 gin::IsolateHolder::kStableV8Extras, |
| 389 gin::ArrayBufferAllocator::SharedInstance()); | 390 gin::ArrayBufferAllocator::SharedInstance()); |
| 390 | 391 |
| 391 has_initialized_v8_ = true; | 392 has_initialized_v8_ = true; |
| 392 } | 393 } |
| 393 | 394 |
| 394 holder_.reset(new gin::IsolateHolder(gin::IsolateHolder::kUseLocker)); | 395 holder_.reset(new gin::IsolateHolder(base::ThreadTaskRunnerHandle::Get(), |
| 396 gin::IsolateHolder::kUseLocker)); |
| 395 } | 397 } |
| 396 | 398 |
| 397 return holder_->isolate(); | 399 return holder_->isolate(); |
| 398 } | 400 } |
| 399 | 401 |
| 400 v8::Isolate* GetSharedIsolateWithoutCreating() { | 402 v8::Isolate* GetSharedIsolateWithoutCreating() { |
| 401 base::AutoLock l(lock_); | 403 base::AutoLock l(lock_); |
| 402 return holder_ ? holder_->isolate() : NULL; | 404 return holder_ ? holder_->isolate() : NULL; |
| 403 } | 405 } |
| 404 | 406 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 return 0; | 901 return 0; |
| 900 | 902 |
| 901 v8::Locker locked(isolate); | 903 v8::Locker locked(isolate); |
| 902 v8::Isolate::Scope isolate_scope(isolate); | 904 v8::Isolate::Scope isolate_scope(isolate); |
| 903 v8::HeapStatistics heap_statistics; | 905 v8::HeapStatistics heap_statistics; |
| 904 isolate->GetHeapStatistics(&heap_statistics); | 906 isolate->GetHeapStatistics(&heap_statistics); |
| 905 return heap_statistics.used_heap_size(); | 907 return heap_statistics.used_heap_size(); |
| 906 } | 908 } |
| 907 | 909 |
| 908 } // namespace net | 910 } // namespace net |
| OLD | NEW |