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

Side by Side Diff: gin/v8_initializer.cc

Issue 1491083002: Set V8 extras mode in gin::V8Initializer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « gin/v8_initializer.h ('k') | mojo/edk/js/tests/js_to_cpp_tests.cc » ('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/v8_initializer.h" 5 #include "gin/v8_initializer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/alias.h" 8 #include "base/debug/alias.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // static 355 // static
356 base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses( 356 base::PlatformFile V8Initializer::GetOpenSnapshotFileForChildProcesses(
357 base::MemoryMappedFile::Region* region_out) { 357 base::MemoryMappedFile::Region* region_out) {
358 OpenSnapshotFileIfNecessary(); 358 OpenSnapshotFileIfNecessary();
359 *region_out = g_snapshot_region; 359 *region_out = g_snapshot_region;
360 return g_snapshot_pf; 360 return g_snapshot_pf;
361 } 361 }
362 #endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) 362 #endif // defined(V8_USE_EXTERNAL_STARTUP_DATA)
363 363
364 // static 364 // static
365 void V8Initializer::Initialize(gin::IsolateHolder::ScriptMode mode) { 365 void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
366 IsolateHolder::V8ExtrasMode v8_extras_mode) {
366 static bool v8_is_initialized = false; 367 static bool v8_is_initialized = false;
367 if (v8_is_initialized) 368 if (v8_is_initialized)
368 return; 369 return;
369 370
370 v8::V8::InitializePlatform(V8Platform::Get()); 371 v8::V8::InitializePlatform(V8Platform::Get());
371 372
372 if (gin::IsolateHolder::kStrictMode == mode) { 373 if (IsolateHolder::kStrictMode == mode) {
373 static const char use_strict[] = "--use_strict"; 374 static const char use_strict[] = "--use_strict";
374 v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1); 375 v8::V8::SetFlagsFromString(use_strict, sizeof(use_strict) - 1);
375 } 376 }
377 if (IsolateHolder::kStableAndExperimentalV8Extras == v8_extras_mode) {
378 static const char flag[] = "--experimental_extras";
379 v8::V8::SetFlagsFromString(flag, sizeof(flag) - 1);
380 }
376 381
377 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 382 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
378 v8::StartupData natives; 383 v8::StartupData natives;
379 natives.data = reinterpret_cast<const char*>(g_mapped_natives->data()); 384 natives.data = reinterpret_cast<const char*>(g_mapped_natives->data());
380 natives.raw_size = static_cast<int>(g_mapped_natives->length()); 385 natives.raw_size = static_cast<int>(g_mapped_natives->length());
381 v8::V8::SetNativesDataBlob(&natives); 386 v8::V8::SetNativesDataBlob(&natives);
382 387
383 if (g_mapped_snapshot != NULL) { 388 if (g_mapped_snapshot != NULL) {
384 v8::StartupData snapshot; 389 v8::StartupData snapshot;
385 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data()); 390 snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data());
(...skipping 24 matching lines...) Expand all
410 *snapshot_data_out = 415 *snapshot_data_out =
411 reinterpret_cast<const char*>(g_mapped_snapshot->data()); 416 reinterpret_cast<const char*>(g_mapped_snapshot->data());
412 *snapshot_size_out = static_cast<int>(g_mapped_snapshot->length()); 417 *snapshot_size_out = static_cast<int>(g_mapped_snapshot->length());
413 } else { 418 } else {
414 *snapshot_data_out = NULL; 419 *snapshot_data_out = NULL;
415 *snapshot_size_out = 0; 420 *snapshot_size_out = 0;
416 } 421 }
417 } 422 }
418 423
419 } // namespace gin 424 } // namespace gin
OLDNEW
« no previous file with comments | « gin/v8_initializer.h ('k') | mojo/edk/js/tests/js_to_cpp_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698