5#ifndef FLUTTER_RUNTIME_SERVICE_PROTOCOL_H_
6#define FLUTTER_RUNTIME_SERVICE_PROTOCOL_H_
13#include "flutter/fml/compiler_specific.h"
14#include "flutter/fml/macros.h"
15#include "flutter/fml/synchronization/atomic_object.h"
16#include "flutter/fml/synchronization/shared_mutex.h"
17#include "flutter/fml/task_runner.h"
18#include "rapidjson/document.h"
43 Description(int64_t p_isolate_port, std::string p_isolate_name)
48 rapidjson::Value& value,
49 rapidjson::MemoryPoolAllocator<>& allocator)
const;
55 std::string_view method)
const = 0;
60 std::string_view method,
62 rapidjson::Document* response) = 0;
79 const std::set<std::string_view> endpoints_;
80 std::unique_ptr<fml::SharedMutex> handlers_mutex_;
81 std::map<Handler*, fml::AtomicObject<Handler::Description>> handlers_;
83 [[nodiscard]]
static bool HandleMessage(
const char* method,
84 const char** param_keys,
85 const char** param_values,
88 const char** json_object);
89 [[nodiscard]]
static bool HandleMessage(
90 std::string_view method,
93 rapidjson::Document* response);
94 [[nodiscard]]
bool HandleMessage(std::string_view method,
96 rapidjson::Document* response)
const;
98 [[nodiscard]]
bool HandleListViewsMethod(rapidjson::Document* response)
const;
virtual bool HandleServiceProtocolMessage(std::string_view method, const ServiceProtocolMap ¶ms, rapidjson::Document *response)=0
std::map< std::string_view, std::string_view > ServiceProtocolMap
virtual fml::RefPtr< fml::TaskRunner > GetServiceProtocolHandlerTaskRunner(std::string_view method) const =0
virtual Description GetServiceProtocolDescription() const =0
void AddHandler(Handler *handler, const Handler::Description &description)
static const std::string_view kSetAssetBundlePathExtensionName
static const std::string_view kReloadAssetFonts
static const std::string_view kScreenshotSkpExtensionName
static const std::string_view kScreenshotExtensionName
static const std::string_view kGetDisplayRefreshRateExtensionName
static const std::string_view kRunInViewExtensionName
static const std::string_view kEstimateRasterCacheMemoryExtensionName
static const std::string_view kGetSkSLsExtensionName
void RemoveHandler(Handler *handler)
static const std::string_view kRenderFrameWithRasterStatsExtensionName
void SetHandlerDescription(Handler *handler, const Handler::Description &description)
static const std::string_view kFlushUIThreadTasksExtensionName
void ToggleHooks(bool set)
const EmbeddedViewParams * params
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
void Write(Handler *handler, rapidjson::Value &value, rapidjson::MemoryPoolAllocator<> &allocator) const
Description(int64_t p_isolate_port, std::string p_isolate_name)