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