Skip to content

Commit c80ea0c

Browse files
committed
src: add FileReader and FileWriter
1 parent 7b9d49c commit c80ea0c

File tree

4 files changed

+470
-2
lines changed

4 files changed

+470
-2
lines changed

src/env.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,13 +1341,18 @@ std::ostream& operator<<(std::ostream& output,
13411341
const std::vector<PropInfo>& vec) {
13421342
output << "{\n";
13431343
for (const auto& info : vec) {
1344-
output << " { \"" << info.name << "\", " << std::to_string(info.id) << ", "
1345-
<< std::to_string(info.index) << " },\n";
1344+
output << " " << info << ",\n";
13461345
}
13471346
output << "}";
13481347
return output;
13491348
}
13501349

1350+
std::ostream& operator<<(std::ostream& output, const PropInfo& info) {
1351+
output << "{ \"" << info.name << "\", " << std::to_string(info.id) << ", "
1352+
<< std::to_string(info.index) << " }";
1353+
return output;
1354+
}
1355+
13511356
std::ostream& operator<<(std::ostream& output,
13521357
const std::vector<std::string>& vec) {
13531358
output << "{\n";

src/env.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,14 @@ struct EnvSerializeInfo {
945945

946946
struct SnapshotData {
947947
SnapshotData() { blob.data = nullptr; }
948+
949+
static const uint64_t kMagic = 0x143da19;
948950
v8::StartupData blob;
949951
std::vector<size_t> isolate_data_indices;
950952
EnvSerializeInfo env_info;
953+
954+
void ToBlob(FILE* out);
955+
static void FromBlob(SnapshotData* out, FILE* in);
951956
};
952957

953958
class Environment : public MemoryRetainer {

src/node_internals.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,25 @@ std::string Basename(const std::string& str, const std::string& extension);
406406

407407
node_module napi_module_to_node_module(const napi_module* mod);
408408

409+
std::ostream& operator<<(std::ostream& output,
410+
const std::vector<SnapshotIndex>& v);
411+
std::ostream& operator<<(std::ostream& output,
412+
const std::vector<std::string>& vec);
413+
std::ostream& operator<<(std::ostream& output,
414+
const std::vector<PropInfo>& vec);
415+
std::ostream& operator<<(std::ostream& output, const PropInfo& d);
416+
std::ostream& operator<<(std::ostream& output, const EnvSerializeInfo& d);
417+
std::ostream& operator<<(std::ostream& output,
418+
const ImmediateInfo::SerializeInfo& d);
419+
std::ostream& operator<<(std::ostream& output,
420+
const TickInfo::SerializeInfo& d);
421+
std::ostream& operator<<(std::ostream& output,
422+
const AsyncHooks::SerializeInfo& d);
423+
424+
namespace performance {
425+
std::ostream& operator<<(std::ostream& output,
426+
const PerformanceState::SerializeInfo& d);
427+
}
409428
} // namespace node
410429

411430
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

0 commit comments

Comments
 (0)