Flutter Engine
flutter::ServiceProtocol Class Reference

#include <service_protocol.h>

Classes

class  Handler
 

Public Member Functions

 ServiceProtocol ()
 
 ~ServiceProtocol ()
 
void ToggleHooks (bool set)
 
void AddHandler (Handler *handler, Handler::Description description)
 
void RemoveHandler (Handler *handler)
 
void SetHandlerDescription (Handler *handler, Handler::Description description)
 

Static Public Attributes

static const std::string_view kScreenshotExtensionName
 
static const std::string_view kScreenshotSkpExtensionName
 
static const std::string_view kRunInViewExtensionName
 
static const std::string_view kFlushUIThreadTasksExtensionName
 
static const std::string_view kSetAssetBundlePathExtensionName
 
static const std::string_view kGetDisplayRefreshRateExtensionName
 
static const std::string_view kGetSkSLsExtensionName
 
static const std::string_view kEstimateRasterCacheMemoryExtensionName
 

Detailed Description

Definition at line 22 of file service_protocol.h.

Constructor & Destructor Documentation

◆ ServiceProtocol()

flutter::ServiceProtocol::ServiceProtocol ( )

Definition at line 45 of file service_protocol.cc.

References fml::SharedMutex::Create(), kEstimateRasterCacheMemoryExtensionName, kFlushUIThreadTasksExtensionName, kGetDisplayRefreshRateExtensionName, kGetSkSLsExtensionName, flutter::kListViewsExtensionName, kRunInViewExtensionName, kScreenshotExtensionName, kScreenshotSkpExtensionName, and kSetAssetBundlePathExtensionName.

46  : endpoints_({
47  // Private
49 
50  // Public
59  }),
60  handlers_mutex_(fml::SharedMutex::Create()) {}
static const std::string_view kGetDisplayRefreshRateExtensionName
static const std::string_view kRunInViewExtensionName
static constexpr std::string_view kListViewsExtensionName
static const std::string_view kScreenshotExtensionName
static const std::string_view kFlushUIThreadTasksExtensionName
static SharedMutex * Create()
static const std::string_view kScreenshotSkpExtensionName
static const std::string_view kSetAssetBundlePathExtensionName
static const std::string_view kGetSkSLsExtensionName
static const std::string_view kEstimateRasterCacheMemoryExtensionName

◆ ~ServiceProtocol()

flutter::ServiceProtocol::~ServiceProtocol ( )

Definition at line 62 of file service_protocol.cc.

References ToggleHooks().

62  {
63  ToggleHooks(false);
64 }

Member Function Documentation

◆ AddHandler()

void flutter::ServiceProtocol::AddHandler ( Handler handler,
Handler::Description  description 
)

Definition at line 66 of file service_protocol.cc.

67  {
68  fml::UniqueLock lock(*handlers_mutex_);
69  handlers_.emplace(handler, description);
70 }

◆ RemoveHandler()

void flutter::ServiceProtocol::RemoveHandler ( Handler handler)

Definition at line 72 of file service_protocol.cc.

72  {
73  fml::UniqueLock lock(*handlers_mutex_);
74  handlers_.erase(handler);
75 }

◆ SetHandlerDescription()

void flutter::ServiceProtocol::SetHandlerDescription ( Handler handler,
Handler::Description  description 
)

Definition at line 77 of file service_protocol.cc.

78  {
79  fml::SharedLock lock(*handlers_mutex_);
80  auto it = handlers_.find(handler);
81  if (it != handlers_.end()) {
82  it->second.Store(description);
83  }
84 }

◆ ToggleHooks()

void flutter::ServiceProtocol::ToggleHooks ( bool  set)

Definition at line 86 of file service_protocol.cc.

Referenced by ~ServiceProtocol().

86  {
87  for (const auto& endpoint : endpoints_) {
88  Dart_RegisterIsolateServiceRequestCallback(
89  endpoint.data(), // method
90  &ServiceProtocol::HandleMessage, // callback
91  set ? this : nullptr // user data
92  );
93  }
94 }

Member Data Documentation

◆ kEstimateRasterCacheMemoryExtensionName

const std::string_view flutter::ServiceProtocol::kEstimateRasterCacheMemoryExtensionName
static
Initial value:
=
"_flutter.estimateRasterCacheMemory"

Definition at line 31 of file service_protocol.h.

Referenced by flutter::Shell::Create(), and ServiceProtocol().

◆ kFlushUIThreadTasksExtensionName

const std::string_view flutter::ServiceProtocol::kFlushUIThreadTasksExtensionName
static
Initial value:
=
"_flutter.flushUIThreadTasks"

Definition at line 27 of file service_protocol.h.

Referenced by flutter::Shell::Create(), flutter::HandleMessageOnHandler(), and ServiceProtocol().

◆ kGetDisplayRefreshRateExtensionName

const std::string_view flutter::ServiceProtocol::kGetDisplayRefreshRateExtensionName
static
Initial value:
=
"_flutter.getDisplayRefreshRate"

Definition at line 29 of file service_protocol.h.

Referenced by flutter::Shell::Create(), and ServiceProtocol().

◆ kGetSkSLsExtensionName

const std::string_view flutter::ServiceProtocol::kGetSkSLsExtensionName
static
Initial value:
=
"_flutter.getSkSLs"

Definition at line 30 of file service_protocol.h.

Referenced by flutter::Shell::Create(), and ServiceProtocol().

◆ kRunInViewExtensionName

const std::string_view flutter::ServiceProtocol::kRunInViewExtensionName
static
Initial value:
=
"_flutter.runInView"

Definition at line 26 of file service_protocol.h.

Referenced by flutter::Shell::Create(), and ServiceProtocol().

◆ kScreenshotExtensionName

const std::string_view flutter::ServiceProtocol::kScreenshotExtensionName
static
Initial value:
=
"_flutter.screenshot"

Definition at line 24 of file service_protocol.h.

Referenced by flutter::Shell::Create(), flutter::HandleMessageOnHandler(), and ServiceProtocol().

◆ kScreenshotSkpExtensionName

const std::string_view flutter::ServiceProtocol::kScreenshotSkpExtensionName
static
Initial value:
=
"_flutter.screenshotSkp"

Definition at line 25 of file service_protocol.h.

Referenced by flutter::Shell::Create(), flutter::HandleMessageOnHandler(), and ServiceProtocol().

◆ kSetAssetBundlePathExtensionName

const std::string_view flutter::ServiceProtocol::kSetAssetBundlePathExtensionName
static
Initial value:
=
"_flutter.setAssetBundlePath"

Definition at line 28 of file service_protocol.h.

Referenced by flutter::Shell::Create(), and ServiceProtocol().


The documentation for this class was generated from the following files: