| 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 | #include "flutter/lib/gpu/smoketest.h" |
| 6 | #include "flutter/fml/memory/ref_ptr.h" |
| 7 | #include "flutter/lib/ui/dart_wrapper.h" |
| 8 | #include "flutter/lib/ui/ui_dart_state.h" |
| 9 | #include "third_party/dart/runtime/include/dart_api.h" |
| 10 | #include "third_party/tonic/converter/dart_converter.h" |
| 11 | #include "third_party/tonic/dart_state.h" |
| 12 | #include "third_party/tonic/dart_wrappable.h" |
| 13 | #include "third_party/tonic/dart_wrapper_info.h" |
| 14 | #include "third_party/tonic/logging/dart_invoke.h" |
| 15 | |
| 16 | namespace flutter { |
| 17 | |
| 18 | // TODO(131346): Remove this once we migrate the Dart GPU API into this space. |
| 19 | IMPLEMENT_WRAPPERTYPEINFO(gpu, FlutterGpuTestClass); |
| 20 | |
| 21 | // TODO(131346): Remove this once we migrate the Dart GPU API into this space. |
| 22 | FlutterGpuTestClass::~FlutterGpuTestClass() = default; |
| 23 | |
| 24 | } // namespace flutter |
| 25 | |
| 26 | //---------------------------------------------------------------------------- |
| 27 | /// Exports |
| 28 | /// |
| 29 | |
| 30 | // TODO(131346): Remove this once we migrate the Dart GPU API into this space. |
| 31 | uint32_t InternalFlutterGpuTestProc() { |
| 32 | return 1; |
| 33 | } |
| 34 | |
| 35 | // TODO(131346): Remove this once we migrate the Dart GPU API into this space. |
| 36 | Dart_Handle InternalFlutterGpuTestProcWithCallback(Dart_Handle callback) { |
| 37 | flutter::UIDartState::ThrowIfUIOperationsProhibited(); |
| 38 | if (!Dart_IsClosure(object: callback)) { |
| 39 | return tonic::ToDart(val: "Callback must be a function"); |
| 40 | } |
| 41 | |
| 42 | tonic::DartInvoke(closure: callback, args: {tonic::ToDart(object: 1234)}); |
| 43 | |
| 44 | return Dart_Null(); |
| 45 | } |
| 46 | |
| 47 | // TODO(131346): Remove this once we migrate the Dart GPU API into this space. |
| 48 | void InternalFlutterGpuTestClass_Create(Dart_Handle wrapper) { |
| 49 | auto res = fml::MakeRefCounted<flutter::FlutterGpuTestClass>(); |
| 50 | res->AssociateWithDartWrapper(wrappable: wrapper); |
| 51 | FML_LOG(INFO) << "FlutterGpuTestClass Wrapped."; |
| 52 | } |
| 53 | |
| 54 | // TODO(131346): Remove this once we migrate the Dart GPU API into this space. |
| 55 | void InternalFlutterGpuTestClass_Method(flutter::FlutterGpuTestClass* self, |
| 56 | int something) { |
| 57 | FML_LOG(INFO) << "Something: "<< something; |
| 58 | } |
| 59 |
