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/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 360 |
361 // Lazily creates a v8::Isolate, or returns the already created instance. | 361 // Lazily creates a v8::Isolate, or returns the already created instance. |
362 v8::Isolate* GetSharedIsolate() { | 362 v8::Isolate* GetSharedIsolate() { |
363 base::AutoLock l(lock_); | 363 base::AutoLock l(lock_); |
364 | 364 |
365 if (!holder_) { | 365 if (!holder_) { |
366 // Do one-time initialization for V8. | 366 // Do one-time initialization for V8. |
367 if (!has_initialized_v8_) { | 367 if (!has_initialized_v8_) { |
368 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 368 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
369 gin::V8Initializer::LoadV8Snapshot(); | 369 gin::V8Initializer::LoadV8Snapshot(); |
| 370 gin::V8Initializer::LoadV8Natives(); |
370 #endif | 371 #endif |
371 | 372 |
372 gin::IsolateHolder::Initialize( | 373 gin::IsolateHolder::Initialize( |
373 gin::IsolateHolder::kNonStrictMode, | 374 gin::IsolateHolder::kNonStrictMode, |
374 gin::ArrayBufferAllocator::SharedInstance()); | 375 gin::ArrayBufferAllocator::SharedInstance()); |
375 | 376 |
376 has_initialized_v8_ = true; | 377 has_initialized_v8_ = true; |
377 } | 378 } |
378 | 379 |
379 holder_.reset(new gin::IsolateHolder(gin::IsolateHolder::kUseLocker)); | 380 holder_.reset(new gin::IsolateHolder(gin::IsolateHolder::kUseLocker)); |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 return 0; | 877 return 0; |
877 | 878 |
878 v8::Locker locked(isolate); | 879 v8::Locker locked(isolate); |
879 v8::Isolate::Scope isolate_scope(isolate); | 880 v8::Isolate::Scope isolate_scope(isolate); |
880 v8::HeapStatistics heap_statistics; | 881 v8::HeapStatistics heap_statistics; |
881 isolate->GetHeapStatistics(&heap_statistics); | 882 isolate->GetHeapStatistics(&heap_statistics); |
882 return heap_statistics.used_heap_size(); | 883 return heap_statistics.used_heap_size(); |
883 } | 884 } |
884 | 885 |
885 } // namespace net | 886 } // namespace net |
OLD | NEW |