MCPcopy Create free account
hub / github.com/Tencent/MMKV / OnCreate

Method OnCreate

flutter/mmkv/example/windows/runner/flutter_window.cpp:12–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10FlutterWindow::~FlutterWindow() {}
11
12bool FlutterWindow::OnCreate() {
13 if (!Win32Window::OnCreate()) {
14 return false;
15 }
16
17 RECT frame = GetClientArea();
18
19 // The size here must match the window dimensions to avoid unnecessary surface
20 // creation / destruction in the startup path.
21 flutter_controller_ = std::make_unique<flutter::FlutterViewController>(
22 frame.right - frame.left, frame.bottom - frame.top, project_);
23 // Ensure that basic setup of the controller was successful.
24 if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 return false;
26 }
27 RegisterPlugins(flutter_controller_->engine());
28 SetChildContent(flutter_controller_->view()->GetNativeWindow());
29
30 flutter_controller_->engine()->SetNextFrameCallback([&]() {
31 this->Show();
32 });
33
34 // Flutter can complete the first frame before the "show window" callback is
35 // registered. The following call ensures a frame is pending to ensure the
36 // window is shown. It is a no-op if the first frame hasn't completed yet.
37 flutter_controller_->ForceRedraw();
38
39 return true;
40}
41
42void FlutterWindow::OnDestroy() {
43 if (flutter_controller_) {

Callers

nothing calls this directly

Calls 2

RegisterPluginsFunction · 0.85
ShowMethod · 0.80

Tested by

no test coverage detected