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

Unified Diff: gin/v8_initializer.h

Issue 1156873002: Load v8 snapshots directly from APK (and store them uncompressed) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8initializer
Patch Set: Pass FDs & Regions through to child process (Still has formatting errors) Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: gin/v8_initializer.h
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
index 68068c4848b567a696ecaa1c028622df010fe990..d5b7ab4a13d42d3e3ee55a440c98ea56b821d36c 100644
--- a/gin/v8_initializer.h
+++ b/gin/v8_initializer.h
@@ -6,6 +6,7 @@
#define GIN_V8_INITIALIZER_H_
#include "base/files/file.h"
+#include "base/files/memory_mapped_file.h"
#include "gin/array_buffer.h"
#include "gin/gin_export.h"
#include "gin/public/isolate_holder.h"
@@ -16,10 +17,6 @@ namespace gin {
class GIN_EXPORT V8Initializer {
public:
- static const int kV8SnapshotBasePathKey;
- static const char kNativesFileName[];
- static const char kSnapshotFileName[];
-
// This should be called by IsolateHolder::Initialize().
static void Initialize(gin::IsolateHolder::ScriptMode mode);
@@ -31,7 +28,16 @@ class GIN_EXPORT V8Initializer {
const char** snapshot_data_out,
int* snapshot_size_out);
-#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+#if defined(OS_POSIX) && defined(V8_USE_EXTERNAL_STARTUP_DATA)
+
+ struct V8Files {
+ base::ScopedFD natives_fd;
+ base::ScopedFD snapshot_fd;
+ base::MemoryMappedFile::Region natives_region;
+ base::MemoryMappedFile::Region snapshot_region;
+ public:
+ bool IsLoaded() const;
+ };
// Load V8 snapshot from user provided platform file descriptors.
// The offset and size arguments, if non-zero, specify the portions
@@ -48,11 +54,9 @@ class GIN_EXPORT V8Initializer {
// snapshot is already loaded, false otherwise.
static bool LoadV8Snapshot();
- // Opens the V8 snapshot data files and returns open file descriptors to these
- // files in |natives_fd_out| and |snapshot_fd_out|, which can be passed to
- // child processes.
- static bool OpenV8FilesForChildProcesses(base::PlatformFile* natives_fd_out,
- base::PlatformFile* snapshot_fd_out);
+ // Opens the V8 snapshot data files and returns open file descriptors and
+ // file regions to these files that can be passed to child processes.
+ static void OpenV8FilesForChildProcesses(V8Files* files_out);
#endif // V8_USE_EXTERNAL_STARTUP_DATA
};

Powered by Google App Engine
This is Rietveld 408576698