diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-20 10:33:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-22 11:45:12 +0000 |
commit | be59a35641616a4cf23c4a13fa0632624b021c1b (patch) | |
tree | 9da183258bdf9cc413f7562079d25ace6955467f /chromium/gin/isolate_holder.cc | |
parent | d702e4b6a64574e97fc7df8fe3238cde70242080 (diff) | |
download | qtwebengine-chromium-be59a35641616a4cf23c4a13fa0632624b021c1b.tar.gz |
BASELINE: Update Chromium to 62.0.3202.101
Change-Id: I2d5eca8117600df6d331f6166ab24d943d9814ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/gin/isolate_holder.cc')
-rw-r--r-- | chromium/gin/isolate_holder.cc | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/chromium/gin/isolate_holder.cc b/chromium/gin/isolate_holder.cc index d42607d86dd..6df4689e0ec 100644 --- a/chromium/gin/isolate_holder.cc +++ b/chromium/gin/isolate_holder.cc @@ -15,6 +15,7 @@ #include "base/message_loop/message_loop.h" #include "base/single_thread_task_runner.h" #include "base/sys_info.h" +#include "build/build_config.h" #include "gin/debug_impl.h" #include "gin/function_template.h" #include "gin/per_isolate_data.h" @@ -35,15 +36,22 @@ IsolateHolder::IsolateHolder( IsolateHolder::IsolateHolder( scoped_refptr<base::SingleThreadTaskRunner> task_runner, AccessMode access_mode) - : IsolateHolder(std::move(task_runner), access_mode, kAllowAtomicsWait) {} + : IsolateHolder(std::move(task_runner), + access_mode, + kAllowAtomicsWait, + nullptr, + nullptr) {} IsolateHolder::IsolateHolder( scoped_refptr<base::SingleThreadTaskRunner> task_runner, AccessMode access_mode, - AllowAtomicsWaitMode atomics_wait_mode) + AllowAtomicsWaitMode atomics_wait_mode, + intptr_t* reference, + v8::StartupData* startup_data) : access_mode_(access_mode) { v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; + v8::Isolate::CreateParams params; params.entry_hook = DebugImpl::GetFunctionEntryHook(); params.code_event_handler = DebugImpl::GetJitCodeEventHandler(); @@ -51,45 +59,28 @@ IsolateHolder::IsolateHolder( base::SysInfo::AmountOfVirtualMemory()); params.array_buffer_allocator = allocator; params.allow_atomics_wait = atomics_wait_mode == kAllowAtomicsWait; - isolate_ = v8::Isolate::New(params); - isolate_data_.reset( - new PerIsolateData(isolate_, allocator, access_mode, task_runner)); - isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); -#if defined(OS_WIN) - { - void* code_range; - size_t size; - isolate_->GetCodeRange(&code_range, &size); - Debug::CodeRangeCreatedCallback callback = - DebugImpl::GetCodeRangeCreatedCallback(); - if (code_range && size && callback) - callback(code_range, size); + params.external_references = reference; + + if (startup_data) { + CHECK(reference); + V8Initializer::GetV8ContextSnapshotData(&startup_data->data, + &startup_data->raw_size); + if (startup_data->data) { + params.snapshot_blob = startup_data; + } } -#endif + isolate_ = v8::Isolate::New(params); + + SetUp(std::move(task_runner)); } IsolateHolder::IsolateHolder(intptr_t* reference_table, v8::StartupData* existing_blob) : snapshot_creator_( new v8::SnapshotCreator(reference_table, existing_blob)), - access_mode_(kSingleThread) { - v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; - CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; - isolate_ = snapshot_creator_->GetIsolate(); - isolate_data_.reset( - new PerIsolateData(isolate_, allocator, access_mode_, nullptr)); - isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); -#if defined(OS_WIN) - { - void* code_range; - size_t size; - isolate_->GetCodeRange(&code_range, &size); - Debug::CodeRangeCreatedCallback callback = - DebugImpl::GetCodeRangeCreatedCallback(); - if (code_range && size && callback) - callback(code_range, size); - } -#endif + isolate_(snapshot_creator_->GetIsolate()), + access_mode_(AccessMode::kSingleThread) { + SetUp(nullptr); } IsolateHolder::~IsolateHolder() { @@ -109,7 +100,7 @@ IsolateHolder::~IsolateHolder() { isolate_memory_dump_provider_.reset(); isolate_data_.reset(); isolate_->Dispose(); - isolate_ = NULL; + isolate_ = nullptr; } // static @@ -139,4 +130,24 @@ void IsolateHolder::EnableIdleTasks( isolate_data_->EnableIdleTasks(std::move(idle_task_runner)); } +void IsolateHolder::SetUp( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) { + v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator; + CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first"; + isolate_data_.reset( + new PerIsolateData(isolate_, allocator, access_mode_, task_runner)); + isolate_memory_dump_provider_.reset(new V8IsolateMemoryDumpProvider(this)); +#if defined(OS_WIN) + { + void* code_range; + size_t size; + isolate_->GetCodeRange(&code_range, &size); + Debug::CodeRangeCreatedCallback callback = + DebugImpl::GetCodeRangeCreatedCallback(); + if (code_range && size && callback) + callback(code_range, size); + } +#endif +} + } // namespace gin |