forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtime_controller.h
81 lines (63 loc) · 2.61 KB
/
runtime_controller.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2015 The Chromium 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_RUNTIME_CONTROLLER_H_
#define FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
#include <memory>
#include "flutter/flow/layers/layer_tree.h"
#include "flutter/lib/ui/ui_dart_state.h"
#include "flutter/lib/ui/window/pointer_data_packet.h"
#include "flutter/lib/ui/window/window.h"
#include "lib/fxl/macros.h"
namespace blink {
class DartController;
class DartLibraryProvider;
class Scene;
class RuntimeDelegate;
class View;
class Window;
class RuntimeController : public WindowClient, public IsolateClient {
public:
static std::unique_ptr<RuntimeController> Create(RuntimeDelegate* client);
~RuntimeController();
void CreateDartController(const std::string& script_uri,
const uint8_t* isolate_snapshot_data,
const uint8_t* isolate_snapshot_instr,
int dirfd = -1);
DartController* dart_controller() const { return dart_controller_.get(); }
void SetViewportMetrics(const ViewportMetrics& metrics);
void SetLocale(const std::string& language_code,
const std::string& country_code);
void SetUserSettingsData(const std::string& data);
void SetSemanticsEnabled(bool enabled);
void BeginFrame(fxl::TimePoint frame_time);
void NotifyIdle(int64_t deadline);
void DispatchPlatformMessage(fxl::RefPtr<PlatformMessage> message);
void DispatchPointerDataPacket(const PointerDataPacket& packet);
void DispatchSemanticsAction(int32_t id,
SemanticsAction action,
std::vector<uint8_t> args);
Dart_Port GetMainPort();
std::string GetIsolateName();
bool HasLivePorts();
tonic::DartErrorHandleType GetLastError();
private:
explicit RuntimeController(RuntimeDelegate* client);
Window* GetWindow();
std::string DefaultRouteName() override;
void ScheduleFrame() override;
void Render(Scene* scene) override;
void UpdateSemantics(SemanticsUpdate* update) override;
void HandlePlatformMessage(fxl::RefPtr<PlatformMessage> message) override;
void DidCreateSecondaryIsolate(Dart_Isolate isolate) override;
void DidShutdownMainIsolate() override;
RuntimeDelegate* client_;
std::string language_code_;
std::string country_code_;
std::string user_settings_data_ = "{}";
bool semantics_enabled_ = false;
std::unique_ptr<DartController> dart_controller_;
FXL_DISALLOW_COPY_AND_ASSIGN(RuntimeController);
};
} // namespace blink
#endif // FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_