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

Side by Side Diff: gin/public/isolate_holder.h

Issue 1019483002: Add support to extension_shell and ash_shell to use external V8 snapshot files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 9 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 | « gin/isolate_holder.cc ('k') | no next file » | 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 #ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_ 5 #ifndef GIN_PUBLIC_ISOLATE_HOLDER_H_
6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_ 6 #define GIN_PUBLIC_ISOLATE_HOLDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/file.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "gin/gin_export.h" 11 #include "gin/gin_export.h"
11 #include "v8/include/v8.h" 12 #include "v8/include/v8.h"
12 13
13 namespace gin { 14 namespace gin {
14 15
15 class PerIsolateData; 16 class PerIsolateData;
16 class RunMicrotasksObserver; 17 class RunMicrotasksObserver;
17 18
18 // To embed Gin, first initialize gin using IsolateHolder::Initialize and then 19 // To embed Gin, first initialize gin using IsolateHolder::Initialize and then
(...skipping 30 matching lines...) Expand all
49 50
50 // This method should also only be called once, and on the MessageLoop's 51 // This method should also only be called once, and on the MessageLoop's
51 // thread. 52 // thread.
52 void RemoveRunMicrotasksObserver(); 53 void RemoveRunMicrotasksObserver();
53 54
54 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 55 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
55 static const int kV8SnapshotBasePathKey; 56 static const int kV8SnapshotBasePathKey;
56 static const char kNativesFileName[]; 57 static const char kNativesFileName[];
57 static const char kSnapshotFileName[]; 58 static const char kSnapshotFileName[];
58 59
60 // Load the V8 snapshot data from the given file descriptors. If offset and
61 // size are zero it will load the whole file, otherwise it will map and load
62 // the region of the file specified by offset and size. Returns true on
63 // success.
James Cook 2015/03/19 15:48:37 Thanks for documenting the other methods!
59 static bool LoadV8SnapshotFd(int natives_fd, 64 static bool LoadV8SnapshotFd(int natives_fd,
60 int64 natives_offset, 65 int64 natives_offset,
61 int64 natives_size, 66 int64 natives_size,
62 int snapshot_fd, 67 int snapshot_fd,
63 int64 snapshot_offset, 68 int64 snapshot_offset,
64 int64 snapshot_size); 69 int64 snapshot_size);
70
71 // Load the V8 snapshot data from the snapshot files. Returns true on success.
65 static bool LoadV8Snapshot(); 72 static bool LoadV8Snapshot();
73
74 // Opens the V8 snapshot data files and returns open file descriptors to these
75 // files in |natives_fd_out| and |snapshot_fd_out|, which can be passed to
76 // child processes.
77 static bool OpenV8FilesForChildProcesses(base::PlatformFile* natives_fd_out,
78 base::PlatformFile* snapshot_fd_out);
79
66 #endif // V8_USE_EXTERNAL_STARTUP_DATA 80 #endif // V8_USE_EXTERNAL_STARTUP_DATA
67 static void GetV8ExternalSnapshotData(const char** natives_data_out, 81 static void GetV8ExternalSnapshotData(const char** natives_data_out,
68 int* natives_size_out, 82 int* natives_size_out,
69 const char** snapshot_data_out, 83 const char** snapshot_data_out,
70 int* snapshot_size_out); 84 int* snapshot_size_out);
71 85
72 private: 86 private:
73 v8::Isolate* isolate_; 87 v8::Isolate* isolate_;
74 scoped_ptr<PerIsolateData> isolate_data_; 88 scoped_ptr<PerIsolateData> isolate_data_;
75 scoped_ptr<RunMicrotasksObserver> task_observer_; 89 scoped_ptr<RunMicrotasksObserver> task_observer_;
76 90
77 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); 91 DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
78 }; 92 };
79 93
80 } // namespace gin 94 } // namespace gin
81 95
82 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ 96 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_
OLDNEW
« no previous file with comments | « gin/isolate_holder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698