2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2018-04-13 13:48:15 -07:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
|
|
|
|
|
#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
2019-03-27 16:16:59 -07:00
|
|
|
#include <unordered_map>
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
#include "flutter/fml/macros.h"
|
2018-04-13 13:48:15 -07:00
|
|
|
#include "flutter/shell/common/shell.h"
|
|
|
|
|
#include "flutter/shell/common/thread_host.h"
|
|
|
|
|
#include "flutter/shell/platform/embedder/embedder.h"
|
2019-02-20 18:59:29 -08:00
|
|
|
#include "flutter/shell/platform/embedder/embedder_engine.h"
|
2019-01-09 15:21:39 -08:00
|
|
|
#include "flutter/shell/platform/embedder/embedder_external_texture_gl.h"
|
2019-03-27 16:16:59 -07:00
|
|
|
#include "flutter/shell/platform/embedder/embedder_thread_host.h"
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2019-04-09 17:10:46 -07:00
|
|
|
namespace flutter {
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2019-10-15 14:26:31 -07:00
|
|
|
struct ShellArgs;
|
|
|
|
|
|
2018-04-13 13:48:15 -07:00
|
|
|
// The object that is returned to the embedder as an opaque pointer to the
|
|
|
|
|
// instance of the Flutter engine.
|
|
|
|
|
class EmbedderEngine {
|
|
|
|
|
public:
|
2019-03-27 16:16:59 -07:00
|
|
|
EmbedderEngine(std::unique_ptr<EmbedderThreadHost> thread_host,
|
2019-10-15 14:26:31 -07:00
|
|
|
TaskRunners task_runners,
|
|
|
|
|
Settings settings,
|
|
|
|
|
RunConfiguration run_configuration,
|
2018-04-13 13:48:15 -07:00
|
|
|
Shell::CreateCallback<PlatformView> on_create_platform_view,
|
2019-01-09 15:21:39 -08:00
|
|
|
Shell::CreateCallback<Rasterizer> on_create_rasterizer,
|
|
|
|
|
EmbedderExternalTextureGL::ExternalTextureCallback
|
|
|
|
|
external_texture_callback);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
~EmbedderEngine();
|
|
|
|
|
|
2019-10-15 14:26:31 -07:00
|
|
|
bool LaunchShell();
|
|
|
|
|
|
|
|
|
|
bool CollectShell();
|
|
|
|
|
|
2019-07-03 15:44:39 -07:00
|
|
|
const TaskRunners& GetTaskRunners() const;
|
|
|
|
|
|
2018-04-13 13:48:15 -07:00
|
|
|
bool NotifyCreated();
|
|
|
|
|
|
|
|
|
|
bool NotifyDestroyed();
|
|
|
|
|
|
2019-10-15 14:26:31 -07:00
|
|
|
bool RunRootIsolate();
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
bool IsValid() const;
|
|
|
|
|
|
2019-04-09 12:44:42 -07:00
|
|
|
bool SetViewportMetrics(flutter::ViewportMetrics metrics);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
bool DispatchPointerDataPacket(
|
2019-04-09 12:44:42 -07:00
|
|
|
std::unique_ptr<flutter::PointerDataPacket> packet);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2019-04-09 12:44:42 -07:00
|
|
|
bool SendPlatformMessage(fml::RefPtr<flutter::PlatformMessage> message);
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2019-01-09 15:21:39 -08:00
|
|
|
bool RegisterTexture(int64_t texture);
|
|
|
|
|
|
|
|
|
|
bool UnregisterTexture(int64_t texture);
|
|
|
|
|
|
|
|
|
|
bool MarkTextureFrameAvailable(int64_t texture);
|
|
|
|
|
|
2019-02-20 18:59:29 -08:00
|
|
|
bool SetSemanticsEnabled(bool enabled);
|
|
|
|
|
|
|
|
|
|
bool SetAccessibilityFeatures(int32_t flags);
|
|
|
|
|
|
|
|
|
|
bool DispatchSemanticsAction(int id,
|
2019-04-09 12:44:42 -07:00
|
|
|
flutter::SemanticsAction action,
|
2019-02-20 18:59:29 -08:00
|
|
|
std::vector<uint8_t> args);
|
|
|
|
|
|
2019-02-21 23:02:32 -08:00
|
|
|
bool OnVsyncEvent(intptr_t baton,
|
|
|
|
|
fml::TimePoint frame_start_time,
|
|
|
|
|
fml::TimePoint frame_target_time);
|
|
|
|
|
|
2019-09-23 13:23:46 -07:00
|
|
|
bool ReloadSystemFonts();
|
|
|
|
|
|
2019-11-22 12:20:02 -08:00
|
|
|
bool PostRenderThreadTask(const fml::closure& task);
|
2019-03-08 16:30:48 -08:00
|
|
|
|
2019-03-27 16:16:59 -07:00
|
|
|
bool RunTask(const FlutterTask* task);
|
|
|
|
|
|
2019-11-08 17:14:50 -08:00
|
|
|
const Shell& GetShell() const;
|
|
|
|
|
|
2018-04-13 13:48:15 -07:00
|
|
|
private:
|
2019-03-27 16:16:59 -07:00
|
|
|
const std::unique_ptr<EmbedderThreadHost> thread_host_;
|
2019-07-03 15:44:39 -07:00
|
|
|
TaskRunners task_runners_;
|
2019-10-15 14:26:31 -07:00
|
|
|
RunConfiguration run_configuration_;
|
|
|
|
|
std::unique_ptr<ShellArgs> shell_args_;
|
2018-04-13 13:48:15 -07:00
|
|
|
std::unique_ptr<Shell> shell_;
|
2019-01-09 15:21:39 -08:00
|
|
|
const EmbedderExternalTextureGL::ExternalTextureCallback
|
|
|
|
|
external_texture_callback_;
|
2018-04-13 13:48:15 -07:00
|
|
|
|
2018-07-26 12:49:34 -07:00
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(EmbedderEngine);
|
2018-04-13 13:48:15 -07:00
|
|
|
};
|
|
|
|
|
|
2019-04-09 17:10:46 -07:00
|
|
|
} // namespace flutter
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_ENGINE_H_
|