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

Unified Diff: gin/isolate_holder.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/rsa_private_key_unittest.cc ('k') | gin/modules/module_registry_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/isolate_holder.cc
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index 2cdacc0bd79233d8db2673c19b81084822bbaca0..2b6d64b35c042b2e183e6cc0c963c2f2ab96d392 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -20,6 +20,9 @@
#include "gin/run_microtasks_observer.h"
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
+#ifdef OS_MACOSX
+#include "base/mac/foundation_util.h"
+#endif // OS_MACOSX
#include "base/path_service.h"
#endif // V8_USE_EXTERNAL_STARTUP_DATA
@@ -68,6 +71,16 @@ bool MapV8Files(base::FilePath* natives_path, base::FilePath* snapshot_path,
return true;
}
+
+#if !defined(OS_MACOSX)
+const int v8_snapshot_dir =
+#if defined(OS_ANDROID)
+ base::DIR_ANDROID_APP_DATA;
+#elif defined(OS_POSIX)
+ base::DIR_EXE;
+#endif // defined(OS_ANDROID)
+#endif // !defined(OS_MACOSX)
+
#endif // V8_USE_EXTERNAL_STARTUP_DATA
} // namespace
@@ -79,18 +92,21 @@ bool IsolateHolder::LoadV8Snapshot() {
if (g_mapped_natives && g_mapped_snapshot)
return true;
+#if !defined(OS_MACOSX)
base::FilePath data_path;
- PathService::Get(
-#if defined(OS_ANDROID)
- base::DIR_ANDROID_APP_DATA,
-#elif defined(OS_POSIX)
- base::DIR_EXE,
-#endif
- &data_path);
+ PathService::Get(v8_snapshot_dir, &data_path);
DCHECK(!data_path.empty());
base::FilePath natives_path = data_path.AppendASCII("natives_blob.bin");
base::FilePath snapshot_path = data_path.AppendASCII("snapshot_blob.bin");
+#else // !defined(OS_MACOSX)
+ base::FilePath natives_path = base::mac::PathForFrameworkBundleResource(
+ CFSTR("natives_blob.bin"));
+ base::FilePath snapshot_path = base::mac::PathForFrameworkBundleResource(
+ CFSTR("snapshot_blob.bin"));
+ DCHECK(!natives_path.empty());
+ DCHECK(!snapshot_path.empty());
+#endif // !defined(OS_MACOSX)
return MapV8Files(&natives_path, &snapshot_path);
}
@@ -181,13 +197,11 @@ void IsolateHolder::Initialize(ScriptMode mode,
v8::StartupData natives;
natives.data = reinterpret_cast<const char*>(g_mapped_natives->data());
natives.raw_size = static_cast<int>(g_mapped_natives->length());
- natives.compressed_size = static_cast<int>(g_mapped_natives->length());
v8::V8::SetNativesDataBlob(&natives);
v8::StartupData snapshot;
snapshot.data = reinterpret_cast<const char*>(g_mapped_snapshot->data());
snapshot.raw_size = static_cast<int>(g_mapped_snapshot->length());
- snapshot.compressed_size = static_cast<int>(g_mapped_snapshot->length());
v8::V8::SetSnapshotDataBlob(&snapshot);
#endif // V8_USE_EXTERNAL_STARTUP_DATA
v8::V8::Initialize();
« no previous file with comments | « crypto/rsa_private_key_unittest.cc ('k') | gin/modules/module_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698