Flutter Engine
scene_host.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_
6 #define FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_
7 
8 #include <lib/ui/scenic/cpp/id.h>
9 #include <zircon/types.h>
10 
11 #include <cstdint>
12 
14 #include "flutter/fml/memory/ref_counted.h"
15 #include "flutter/fml/task_runner.h"
16 #include "flutter/lib/ui/dart_wrapper.h"
19 
20 namespace flutter {
21 
22 class SceneHost : public RefCountedDartWrappable<SceneHost> {
23  DEFINE_WRAPPERTYPEINFO();
24  FML_FRIEND_MAKE_REF_COUNTED(SceneHost);
25 
26  public:
27  static void RegisterNatives(tonic::DartLibraryNatives* natives);
29  fml::RefPtr<zircon::dart::Handle> viewHolderToken,
30  Dart_Handle viewConnectedCallback,
31  Dart_Handle viewDisconnectedCallback,
32  Dart_Handle viewStateChangedCallback);
33  static void OnViewConnected(scenic::ResourceId id);
34  static void OnViewDisconnected(scenic::ResourceId id);
35  static void OnViewStateChanged(scenic::ResourceId id, bool state);
36 
37  ~SceneHost() override;
38 
39  zx_koid_t id() const { return koid_; }
40 
41  // These are visible to Dart.
42  void dispose();
43  void setProperties(double width,
44  double height,
45  double insetTop,
46  double insetRight,
47  double insetBottom,
48  double insetLeft,
49  bool focusable);
50 
51  private:
53  Dart_Handle viewConnectedCallback,
54  Dart_Handle viewDisconnectedCallback,
55  Dart_Handle viewStateChangedCallback);
56 
57  fml::RefPtr<fml::TaskRunner> raster_task_runner_;
58  tonic::DartPersistentValue view_connected_callback_;
59  tonic::DartPersistentValue view_disconnected_callback_;
60  tonic::DartPersistentValue view_state_changed_callback_;
61  std::string isolate_service_id_;
62  zx_koid_t koid_ = ZX_KOID_INVALID;
63 };
64 
65 } // namespace flutter
66 
67 #endif // FLUTTER_LIB_UI_COMPOSITING_SCENE_HOST_H_
static void OnViewDisconnected(scenic::ResourceId id)
Definition: scene_host.cc:146
static void OnViewConnected(scenic::ResourceId id)
Definition: scene_host.cc:138
static fml::RefPtr< SceneHost > Create(fml::RefPtr< zircon::dart::Handle > viewHolderToken, Dart_Handle viewConnectedCallback, Dart_Handle viewDisconnectedCallback, Dart_Handle viewStateChangedCallback)
Definition: scene_host.cc:128
~SceneHost() override
Definition: scene_host.cc:206
zx_koid_t id() const
Definition: scene_host.h:39
int32_t height
int32_t width
static void RegisterNatives(tonic::DartLibraryNatives *natives)
Definition: scene_host.cc:123
static void OnViewStateChanged(scenic::ResourceId id, bool state)
Definition: scene_host.cc:154
void setProperties(double width, double height, double insetTop, double insetRight, double insetBottom, double insetLeft, bool focusable)
Definition: scene_host.cc:217