scene_host.cc 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "flutter/lib/ui/compositing/scene_host.h"

#include "lib/tonic/dart_args.h"
#include "lib/tonic/dart_binding_macros.h"
#include "lib/tonic/dart_library_natives.h"
10
#include "lib/tonic/dart_wrappable.h"
11

12
#ifdef OS_FUCHSIA
13
#include "dart-pkg/zircon/sdk_ext/handle.h"
14 15
#endif

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
namespace blink {

static void SceneHost_constructor(Dart_NativeArguments args) {
  DartCallConstructor(&SceneHost::create, args);
}

IMPLEMENT_WRAPPERTYPEINFO(ui, SceneHost);

#define FOR_EACH_BINDING(V) V(SceneHost, dispose)

FOR_EACH_BINDING(DART_NATIVE_CALLBACK)

void SceneHost::RegisterNatives(tonic::DartLibraryNatives* natives) {
  natives->Register({{"SceneHost_constructor", SceneHost_constructor, 2, true},
                     FOR_EACH_BINDING(DART_REGISTER_NATIVE)});
}

33 34
#if defined(OS_FUCHSIA)
ftl::RefPtr<SceneHost> SceneHost::create(
35
    ftl::RefPtr<zircon::dart::Handle> export_token_handle) {
36 37 38
  return ftl::MakeRefCounted<SceneHost>(export_token_handle);
}

39
SceneHost::SceneHost(ftl::RefPtr<zircon::dart::Handle> export_token_handle) {
40 41
  export_node_holder_ =
      ftl::MakeRefCounted<flow::ExportNodeHolder>(export_token_handle);
42
}
43 44 45 46 47 48 49
#else
ftl::RefPtr<SceneHost> SceneHost::create(Dart_Handle export_token_handle) {
  return ftl::MakeRefCounted<SceneHost>(export_token_handle);
}

SceneHost::SceneHost(Dart_Handle export_token_handle) {}
#endif
50 51 52 53 54 55 56 57

SceneHost::~SceneHost() {}

void SceneHost::dispose() {
  ClearDartWrapper();
}

}  // namespace blink