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( | 30 IsolateHolder::IsolateHolder( |
31 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
32 : IsolateHolder(std::move(task_runner), AccessMode::kSingleThread) {} | 32 : IsolateHolder(std::move(task_runner), AccessMode::kSingleThread) {} |
33 | 33 |
34 IsolateHolder::IsolateHolder( | 34 IsolateHolder::IsolateHolder( |
35 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 35 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
36 AccessMode access_mode) | 36 AccessMode access_mode, |
| 37 AllowAtomicsWaitMode atomics_wait_mode) |
37 : access_mode_(access_mode) { | 38 : access_mode_(access_mode) { |
38 v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; | 39 v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; |
39 CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; | 40 CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; |
40 v8::Isolate::CreateParams params; | 41 v8::Isolate::CreateParams params; |
41 params.entry_hook = DebugImpl::GetFunctionEntryHook(); | 42 params.entry_hook = DebugImpl::GetFunctionEntryHook(); |
42 params.code_event_handler = DebugImpl::GetJitCodeEventHandler(); | 43 params.code_event_handler = DebugImpl::GetJitCodeEventHandler(); |
43 params.constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(), | 44 params.constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(), |
44 base::SysInfo::AmountOfVirtualMemory()); | 45 base::SysInfo::AmountOfVirtualMemory()); |
45 params.array_buffer_allocator = allocator; | 46 params.array_buffer_allocator = allocator; |
| 47 params.allow_atomics_wait = atomics_wait_mode == kAllowAtomicsWait; |
46 isolate_ = v8::Isolate::New(params); | 48 isolate_ = v8::Isolate::New(params); |
47 isolate_data_.reset( | 49 isolate_data_.reset( |
48 new PerIsolateData(isolate_, allocator, access_mode, task_runner)); | 50 new PerIsolateData(isolate_, allocator, access_mode, task_runner)); |
49 isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); | 51 isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); |
50 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
51 { | 53 { |
52 void* code_range; | 54 void* code_range; |
53 size_t size; | 55 size_t size; |
54 isolate_->GetCodeRange(&code_range, &size); | 56 isolate_->GetCodeRange(&code_range, &size); |
55 Debug::CodeRangeCreatedCallback callback = | 57 Debug::CodeRangeCreatedCallback callback = |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 task_observer_.reset(); | 103 task_observer_.reset(); |
102 } | 104 } |
103 | 105 |
104 void IsolateHolder::EnableIdleTasks( | 106 void IsolateHolder::EnableIdleTasks( |
105 std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { | 107 std::unique_ptr<V8IdleTaskRunner> idle_task_runner) { |
106 DCHECK(isolate_data_.get()); | 108 DCHECK(isolate_data_.get()); |
107 isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); | 109 isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); |
108 } | 110 } |
109 | 111 |
110 } // namespace gin | 112 } // namespace gin |
OLD | NEW |