flutter_flutter/lib/ui/semantics/semantics_update.cc
Alexander Aprelev 1c8ee9856b
Introduce runtime check that it is root isolate that makes UI native calls. (#18050)
* Revert "Do not register UI-related native functions in secondary isolates (#6401)"

This reverts commit 69ae5694de54d2a163743dcec727fcea1c7bc8e1 as it doesn't work when root and secondary isolates run in the same isolate group.

* Confirm it is root isolate that makes UI native calls.

* Fix format, UIDartState reference from Fuchsia source

* No UI isolate check for fuchsia calls

* Fix typo. Remove redundant runtime calls
2020-05-01 09:05:41 -07:00

51 lines
1.6 KiB
C++

// Copyright 2013 The Flutter 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/semantics/semantics_update_builder.h"
#include <memory>
#include "flutter/lib/ui/painting/matrix.h"
#include "flutter/lib/ui/ui_dart_state.h"
#include "third_party/tonic/converter/dart_converter.h"
#include "third_party/tonic/dart_args.h"
#include "third_party/tonic/dart_binding_macros.h"
#include "third_party/tonic/dart_library_natives.h"
namespace flutter {
IMPLEMENT_WRAPPERTYPEINFO(ui, SemanticsUpdate);
#define FOR_EACH_BINDING(V) V(SemanticsUpdate, dispose)
DART_BIND_ALL(SemanticsUpdate, FOR_EACH_BINDING)
void SemanticsUpdate::create(Dart_Handle semantics_update_handle,
SemanticsNodeUpdates nodes,
CustomAccessibilityActionUpdates actions) {
auto semantics_update = fml::MakeRefCounted<SemanticsUpdate>(
std::move(nodes), std::move(actions));
semantics_update->AssociateWithDartWrapper(semantics_update_handle);
}
SemanticsUpdate::SemanticsUpdate(SemanticsNodeUpdates nodes,
CustomAccessibilityActionUpdates actions)
: nodes_(std::move(nodes)), actions_(std::move(actions)) {}
SemanticsUpdate::~SemanticsUpdate() = default;
SemanticsNodeUpdates SemanticsUpdate::takeNodes() {
return std::move(nodes_);
}
CustomAccessibilityActionUpdates SemanticsUpdate::takeActions() {
return std::move(actions_);
}
void SemanticsUpdate::dispose() {
ClearDartWrapper();
}
} // namespace flutter