forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dart_snapshot.h
61 lines (41 loc) · 1.63 KB
/
dart_snapshot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2017 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_RUNTIME_DART_SNAPSHOT_H_
#define FLUTTER_RUNTIME_DART_SNAPSHOT_H_
#include <memory>
#include <string>
#include "flutter/common/settings.h"
#include "flutter/fml/macros.h"
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/runtime/dart_snapshot_buffer.h"
namespace blink {
class DartSnapshot : public fml::RefCountedThreadSafe<DartSnapshot> {
public:
static const char* kVMDataSymbol;
static const char* kVMInstructionsSymbol;
static const char* kIsolateDataSymbol;
static const char* kIsolateInstructionsSymbol;
static fml::RefPtr<DartSnapshot> VMSnapshotFromSettings(
const Settings& settings);
static fml::RefPtr<DartSnapshot> IsolateSnapshotFromSettings(
const Settings& settings);
static fml::RefPtr<DartSnapshot> Empty();
bool IsValid() const;
bool IsValidForAOT() const;
const DartSnapshotBuffer* GetData() const;
const DartSnapshotBuffer* GetInstructions() const;
const uint8_t* GetDataIfPresent() const;
const uint8_t* GetInstructionsIfPresent() const;
private:
std::unique_ptr<DartSnapshotBuffer> data_;
std::unique_ptr<DartSnapshotBuffer> instructions_;
DartSnapshot(std::unique_ptr<DartSnapshotBuffer> data,
std::unique_ptr<DartSnapshotBuffer> instructions);
~DartSnapshot();
FML_FRIEND_REF_COUNTED_THREAD_SAFE(DartSnapshot);
FML_FRIEND_MAKE_REF_COUNTED(DartSnapshot);
FML_DISALLOW_COPY_AND_ASSIGN(DartSnapshot);
};
} // namespace blink
#endif // FLUTTER_RUNTIME_DART_SNAPSHOT_H_