Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Side by Side Diff: gin/isolate_holder.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/thread_proxy.cc ('k') | gpu/GLES2/gl2chromium_autogen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/field_trial.h"
13 #include "base/rand_util.h" 14 #include "base/rand_util.h"
14 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
15 #include "base/sys_info.h" 16 #include "base/sys_info.h"
16 #include "crypto/sha2.h" 17 #include "crypto/sha2.h"
17 #include "gin/array_buffer.h" 18 #include "gin/array_buffer.h"
18 #include "gin/debug_impl.h" 19 #include "gin/debug_impl.h"
19 #include "gin/function_template.h" 20 #include "gin/function_template.h"
20 #include "gin/per_isolate_data.h" 21 #include "gin/per_isolate_data.h"
21 #include "gin/public/v8_platform.h" 22 #include "gin/public/v8_platform.h"
22 #include "gin/run_microtasks_observer.h" 23 #include "gin/run_microtasks_observer.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 void IsolateHolder::Initialize(ScriptMode mode, 260 void IsolateHolder::Initialize(ScriptMode mode,
260 v8::ArrayBuffer::Allocator* allocator) { 261 v8::ArrayBuffer::Allocator* allocator) {
261 CHECK(allocator); 262 CHECK(allocator);
262 static bool v8_is_initialized = false; 263 static bool v8_is_initialized = false;
263 if (v8_is_initialized) 264 if (v8_is_initialized)
264 return; 265 return;
265 v8::V8::InitializePlatform(V8Platform::Get()); 266 v8::V8::InitializePlatform(V8Platform::Get());
266 v8::V8::SetArrayBufferAllocator(allocator); 267 v8::V8::SetArrayBufferAllocator(allocator);
267 g_array_buffer_allocator = allocator; 268 g_array_buffer_allocator = allocator;
268 if (mode == gin::IsolateHolder::kStrictMode) { 269 if (mode == gin::IsolateHolder::kStrictMode) {
269 static const char v8_flags[] = "--use_strict"; 270 static const char use_strict[] = "--use_strict";
270 v8::V8::SetFlagsFromString(v8_flags, sizeof(v8_flags) - 1); 271 v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1);
272 }
273 if (base::FieldTrialList::FindFullName("V8VerifyHeap") == "Enabled") {
274 static const char verify_heap[] = "--verify_heap";
275 v8::V8::SetFlagsFromString(verify_heap, sizeof(verify_heap) - 1);
271 } 276 }
272 v8::V8::SetEntropySource(&GenerateEntropy); 277 v8::V8::SetEntropySource(&GenerateEntropy);
273 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 278 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
274 v8::StartupData natives; 279 v8::StartupData natives;
275 natives.data = reinterpret_cast<const char*>(g_mapped_natives->data()); 280 natives.data = reinterpret_cast<const char*>(g_mapped_natives->data());
276 natives.raw_size = static_cast<int>(g_mapped_natives->length()); 281 natives.raw_size = static_cast<int>(g_mapped_natives->length());
277 v8::V8::SetNativesDataBlob(&natives); 282 v8::V8::SetNativesDataBlob(&natives);
278 283
279 v8::StartupData snapshot; 284 v8::StartupData snapshot;
280 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data()); 285 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data());
(...skipping 10 matching lines...) Expand all
291 base::MessageLoop::current()->AddTaskObserver(task_observer_.get()); 296 base::MessageLoop::current()->AddTaskObserver(task_observer_.get());
292 } 297 }
293 298
294 void IsolateHolder::RemoveRunMicrotasksObserver() { 299 void IsolateHolder::RemoveRunMicrotasksObserver() {
295 DCHECK(task_observer_.get()); 300 DCHECK(task_observer_.get());
296 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get()); 301 base::MessageLoop::current()->RemoveTaskObserver(task_observer_.get());
297 task_observer_.reset(); 302 task_observer_.reset();
298 } 303 }
299 304
300 } // namespace gin 305 } // namespace gin
OLDNEW
« no previous file with comments | « cc/trees/thread_proxy.cc ('k') | gpu/GLES2/gl2chromium_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698