Flutter Engine
flutter::SceneHost Class Reference

#include <scene_host.h>

Inheritance diagram for flutter::SceneHost:
flutter::RefCountedDartWrappable< SceneHost > fml::RefCountedThreadSafe< SceneHost > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ~SceneHost () override
 
zx_koid_t id () const
 
void dispose ()
 
void setProperties (double width, double height, double insetTop, double insetRight, double insetBottom, double insetLeft, bool focusable)
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< SceneHost >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< SceneHost >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
virtual size_t GetAllocationSize () const
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static void RegisterNatives (tonic::DartLibraryNatives *natives)
 
static fml::RefPtr< SceneHostCreate (fml::RefPtr< zircon::dart::Handle > viewHolderToken, Dart_Handle viewConnectedCallback, Dart_Handle viewDisconnectedCallback, Dart_Handle viewStateChangedCallback)
 
static void OnViewConnected (scenic::ResourceId id)
 
static void OnViewDisconnected (scenic::ResourceId id)
 
static void OnViewStateChanged (scenic::ResourceId id, bool state)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex,
  kWrapperInfoIndex,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< SceneHost >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 22 of file scene_host.h.

Constructor & Destructor Documentation

◆ ~SceneHost()

flutter::SceneHost::~SceneHost ( )
override

Definition at line 206 of file scene_host.cc.

References flutter::ViewHolder::Destroy().

206  {
207  scene_host_bindings.erase(SceneHostBindingKey(koid_, isolate_service_id_));
208 
209  raster_task_runner_->PostTask(
210  [id = koid_]() { flutter::ViewHolder::Destroy(id); });
211 }
virtual void PostTask(const fml::closure &task)
Definition: task_runner.cc:24
static void Destroy(zx_koid_t id)
Definition: view_holder.cc:73

Member Function Documentation

◆ Create()

fml::RefPtr< SceneHost > flutter::SceneHost::Create ( fml::RefPtr< zircon::dart::Handle viewHolderToken,
Dart_Handle  viewConnectedCallback,
Dart_Handle  viewDisconnectedCallback,
Dart_Handle  viewStateChangedCallback 
)
static

Definition at line 128 of file scene_host.cc.

132  {
133  return fml::MakeRefCounted<SceneHost>(viewHolderToken, viewConnectedCallback,
134  viewDisconnectedCallback,
135  viewStateChangedCallback);
136 }

◆ dispose()

void flutter::SceneHost::dispose ( )

Definition at line 213 of file scene_host.cc.

Referenced by id().

213  {
215 }

◆ id()

zx_koid_t flutter::SceneHost::id ( ) const
inline

Definition at line 39 of file scene_host.h.

References dispose(), height, setProperties(), and width.

Referenced by flutter::SceneBuilder::addPlatformView().

39 { return koid_; }

◆ OnViewConnected()

void flutter::SceneHost::OnViewConnected ( scenic::ResourceId  id)
static

Definition at line 138 of file scene_host.cc.

Referenced by flutter_runner::PlatformView::PlatformView().

138  {
139  auto* scene_host = GetSceneHostForCurrentIsolate(id);
140 
141  if (scene_host && !scene_host->view_connected_callback_.is_empty()) {
142  InvokeDartClosure(scene_host->view_connected_callback_);
143  }
144 }

◆ OnViewDisconnected()

void flutter::SceneHost::OnViewDisconnected ( scenic::ResourceId  id)
static

Definition at line 146 of file scene_host.cc.

Referenced by flutter_runner::PlatformView::PlatformView().

146  {
147  auto* scene_host = GetSceneHostForCurrentIsolate(id);
148 
149  if (scene_host && !scene_host->view_disconnected_callback_.is_empty()) {
150  InvokeDartClosure(scene_host->view_disconnected_callback_);
151  }
152 }

◆ OnViewStateChanged()

void flutter::SceneHost::OnViewStateChanged ( scenic::ResourceId  id,
bool  state 
)
static

Definition at line 154 of file scene_host.cc.

References flutter::ViewHolder::Create(), zircon::dart::Handle::handle(), id, and zircon::dart::Handle::ReleaseHandle().

Referenced by flutter_runner::PlatformView::PlatformView().

154  {
155  auto* scene_host = GetSceneHostForCurrentIsolate(id);
156 
157  if (scene_host && !scene_host->view_state_changed_callback_.is_empty()) {
158  InvokeDartFunction(scene_host->view_state_changed_callback_, state);
159  }
160 }

◆ RegisterNatives()

void flutter::SceneHost::RegisterNatives ( tonic::DartLibraryNatives natives)
static

Definition at line 123 of file scene_host.cc.

References DART_REGISTER_NATIVE, and FOR_EACH_BINDING.

Referenced by flutter::DartUI::InitForGlobal().

123  {
124  natives->Register({{"SceneHost_constructor", SceneHost_constructor, 5, true},
126 }
#define FOR_EACH_BINDING(V)
Definition: scene_host.cc:117
void Register(std::initializer_list< Entry > entries)
#define DART_REGISTER_NATIVE(CLASS, METHOD)

◆ setProperties()

void flutter::SceneHost::setProperties ( double  width,
double  height,
double  insetTop,
double  insetRight,
double  insetBottom,
double  insetLeft,
bool  focusable 
)

Definition at line 217 of file scene_host.cc.

References FML_DCHECK, and flutter::ViewHolder::FromId().

Referenced by id().

223  {
224  raster_task_runner_->PostTask([id = koid_, width, height, insetTop,
225  insetRight, insetBottom, insetLeft,
226  focusable]() {
227  auto* view_holder = flutter::ViewHolder::FromId(id);
228  FML_DCHECK(view_holder);
229 
230  view_holder->SetProperties(width, height, insetTop, insetRight, insetBottom,
231  insetLeft, focusable);
232  });
233 }
#define FML_DCHECK(condition)
Definition: logging.h:86
virtual void PostTask(const fml::closure &task)
Definition: task_runner.cc:24
int32_t height
int32_t width
static ViewHolder * FromId(zx_koid_t id)
Definition: view_holder.cc:80

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