| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gin/public/isolate_holder.h" | 5 #include "gin/public/isolate_holder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace { | 26 namespace { |
| 27 v8::ArrayBuffer::Allocator* g_array_buffer_allocator = nullptr; | 27 v8::ArrayBuffer::Allocator* g_array_buffer_allocator = nullptr; |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 IsolateHolder::IsolateHolder() : IsolateHolder(AccessMode::kSingleThread) { | 30 IsolateHolder::IsolateHolder() : IsolateHolder(AccessMode::kSingleThread) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 IsolateHolder::IsolateHolder(AccessMode access_mode) | 33 IsolateHolder::IsolateHolder(AccessMode access_mode) |
| 34 : access_mode_(access_mode) { | 34 : access_mode_(access_mode) { |
| 35 v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; | 35 v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; |
| 36 CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; | 36 // You need to invoke gin::IsolateHolder::Initialize first |
| 37 CHECK(allocator); |
| 37 v8::Isolate::CreateParams params; | 38 v8::Isolate::CreateParams params; |
| 38 params.entry_hook = DebugImpl::GetFunctionEntryHook(); | 39 params.entry_hook = DebugImpl::GetFunctionEntryHook(); |
| 39 params.code_event_handler = DebugImpl::GetJitCodeEventHandler(); | 40 params.code_event_handler = DebugImpl::GetJitCodeEventHandler(); |
| 40 params.constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(), | 41 params.constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(), |
| 41 base::SysInfo::AmountOfVirtualMemory()); | 42 base::SysInfo::AmountOfVirtualMemory()); |
| 42 params.array_buffer_allocator = allocator; | 43 params.array_buffer_allocator = allocator; |
| 43 isolate_ = v8::Isolate::New(params); | 44 isolate_ = v8::Isolate::New(params); |
| 44 isolate_data_.reset(new PerIsolateData(isolate_, allocator, access_mode)); | 45 isolate_data_.reset(new PerIsolateData(isolate_, allocator, access_mode)); |
| 45 isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); | 46 isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); |
| 46 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 task_observer_.reset(); | 98 task_observer_.reset(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void IsolateHolder::EnableIdleTasks( | 101 void IsolateHolder::EnableIdleTasks( |
| 101 std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { | 102 std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { |
| 102 DCHECK(isolate_data_.get()); | 103 DCHECK(isolate_data_.get()); |
| 103 isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); | 104 isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace gin | 107 } // namespace gin |
| OLD | NEW |