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

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

Issue 594603003: Infrastructure for reading V8's initial snapshot from external files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Turn static variables into pointers and remove v8 init in net Created 6 years, 3 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
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 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
10 #include "base/files/memory_mapped_file.h"
11 #endif // V8_USE_EXTERNAL_STARTUP_DATA
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "gin/gin_export.h" 13 #include "gin/gin_export.h"
11 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
12 15
13 namespace gin { 16 namespace gin {
14 17
15 class PerIsolateData; 18 class PerIsolateData;
16 19
17 // To embed Gin, first initialize gin using IsolateHolder::Initialize and then 20 // To embed Gin, first initialize gin using IsolateHolder::Initialize and then
18 // create an instance of IsolateHolder to hold the v8::Isolate in which you 21 // create an instance of IsolateHolder to hold the v8::Isolate in which you
(...skipping 10 matching lines...) Expand all
29 IsolateHolder(); 32 IsolateHolder();
30 ~IsolateHolder(); 33 ~IsolateHolder();
31 34
32 // Should be invoked once before creating IsolateHolder instances to 35 // Should be invoked once before creating IsolateHolder instances to
33 // initialize V8 and Gin. 36 // initialize V8 and Gin.
34 static void Initialize(ScriptMode mode, 37 static void Initialize(ScriptMode mode,
35 v8::ArrayBuffer::Allocator* allocator); 38 v8::ArrayBuffer::Allocator* allocator);
36 39
37 v8::Isolate* isolate() { return isolate_; } 40 v8::Isolate* isolate() { return isolate_; }
38 41
42 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
43 #ifdef OS_ANDROID
44 static bool LoadV8SnapshotFD(int natives_fd, int snapshot_fd);
45 #endif
46 static bool LoadV8Snapshot();
47 #endif // V8_USE_EXTERNAL_STARTUP_DATA
48
39 private: 49 private:
40 v8::Isolate* isolate_; 50 v8::Isolate* isolate_;
41 scoped_ptr<PerIsolateData> isolate_data_; 51 scoped_ptr<PerIsolateData> isolate_data_;
42 52
53 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
54 static base::MemoryMappedFile* mapped_natives;
55 static base::MemoryMappedFile* mapped_snapshot;
rmcilroy 2014/09/23 14:05:40 As mentioned, remove these from this class and mak
baixo 2014/09/23 19:30:30 Done.
56 #endif // V8_USE_EXTERNAL_STARTUP_DATA
57
43 DISALLOW_COPY_AND_ASSIGN(IsolateHolder); 58 DISALLOW_COPY_AND_ASSIGN(IsolateHolder);
44 }; 59 };
45 60
46 } // namespace gin 61 } // namespace gin
47 62
48 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_ 63 #endif // GIN_PUBLIC_ISOLATE_HOLDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698