9
9
#include " flutter/fml/native_library.h"
10
10
#include " flutter/fml/paths.h"
11
11
#include " flutter/fml/trace_event.h"
12
+ #include " flutter/lib/snapshot/snapshot.h"
12
13
#include " flutter/runtime/dart_snapshot_buffer.h"
13
14
#include " flutter/runtime/dart_vm.h"
14
15
@@ -20,8 +21,7 @@ const char* DartSnapshot::kIsolateDataSymbol = "kDartIsolateSnapshotData";
20
21
const char * DartSnapshot::kIsolateInstructionsSymbol =
21
22
" kDartIsolateSnapshotInstructions" ;
22
23
23
- static std::unique_ptr<DartSnapshotBuffer> ResolveVMData (
24
- const Settings& settings) {
24
+ std::unique_ptr<DartSnapshotBuffer> ResolveVMData (const Settings& settings) {
25
25
if (settings.aot_snapshot_path .size () > 0 ) {
26
26
auto path = fml::paths::JoinPaths (
27
27
{settings.aot_snapshot_path , settings.aot_vm_snapshot_data_filename });
@@ -36,7 +36,7 @@ static std::unique_ptr<DartSnapshotBuffer> ResolveVMData(
36
36
loaded_process, DartSnapshot::kVMDataSymbol );
37
37
}
38
38
39
- static std::unique_ptr<DartSnapshotBuffer> ResolveVMInstructions (
39
+ std::unique_ptr<DartSnapshotBuffer> ResolveVMInstructions (
40
40
const Settings& settings) {
41
41
if (settings.aot_snapshot_path .size () > 0 ) {
42
42
auto path = fml::paths::JoinPaths (
@@ -61,7 +61,7 @@ static std::unique_ptr<DartSnapshotBuffer> ResolveVMInstructions(
61
61
loaded_process, DartSnapshot::kVMInstructionsSymbol );
62
62
}
63
63
64
- static std::unique_ptr<DartSnapshotBuffer> ResolveIsolateData (
64
+ std::unique_ptr<DartSnapshotBuffer> ResolveIsolateData (
65
65
const Settings& settings) {
66
66
if (settings.aot_snapshot_path .size () > 0 ) {
67
67
auto path =
@@ -78,7 +78,7 @@ static std::unique_ptr<DartSnapshotBuffer> ResolveIsolateData(
78
78
loaded_process, DartSnapshot::kIsolateDataSymbol );
79
79
}
80
80
81
- static std::unique_ptr<DartSnapshotBuffer> ResolveIsolateInstructions (
81
+ std::unique_ptr<DartSnapshotBuffer> ResolveIsolateInstructions (
82
82
const Settings& settings) {
83
83
if (settings.aot_snapshot_path .size () > 0 ) {
84
84
auto path =
@@ -107,6 +107,12 @@ static std::unique_ptr<DartSnapshotBuffer> ResolveIsolateInstructions(
107
107
fxl::RefPtr<DartSnapshot> DartSnapshot::VMSnapshotFromSettings (
108
108
const Settings& settings) {
109
109
TRACE_EVENT0 (" flutter" , " DartSnapshot::VMSnapshotFromSettings" );
110
+ #if OS_WIN
111
+ return fxl::MakeRefCounted<DartSnapshot>(
112
+ DartSnapshotBuffer::CreateWithUnmanagedAllocation (kDartVmSnapshotData ),
113
+ DartSnapshotBuffer::CreateWithUnmanagedAllocation (
114
+ kDartVmSnapshotInstructions ));
115
+ #else // OS_WIN
110
116
auto snapshot =
111
117
fxl::MakeRefCounted<DartSnapshot>(ResolveVMData (settings), //
112
118
ResolveVMInstructions (settings) //
@@ -115,11 +121,19 @@ fxl::RefPtr<DartSnapshot> DartSnapshot::VMSnapshotFromSettings(
115
121
return snapshot;
116
122
}
117
123
return nullptr ;
124
+ #endif // OS_WIN
118
125
}
119
126
120
127
fxl::RefPtr<DartSnapshot> DartSnapshot::IsolateSnapshotFromSettings (
121
128
const Settings& settings) {
122
129
TRACE_EVENT0 (" flutter" , " DartSnapshot::IsolateSnapshotFromSettings" );
130
+ #if OS_WIN
131
+ return fxl::MakeRefCounted<DartSnapshot>(
132
+ DartSnapshotBuffer::CreateWithUnmanagedAllocation (
133
+ kDartIsolateSnapshotData ),
134
+ DartSnapshotBuffer::CreateWithUnmanagedAllocation (
135
+ kDartIsolateSnapshotInstructions ));
136
+ #else // OS_WIN
123
137
auto snapshot =
124
138
fxl::MakeRefCounted<DartSnapshot>(ResolveIsolateData (settings), //
125
139
ResolveIsolateInstructions (settings) //
@@ -128,6 +142,7 @@ fxl::RefPtr<DartSnapshot> DartSnapshot::IsolateSnapshotFromSettings(
128
142
return snapshot;
129
143
}
130
144
return nullptr ;
145
+ #endif
131
146
}
132
147
133
148
DartSnapshot::DartSnapshot (std::unique_ptr<DartSnapshotBuffer> data,
0 commit comments