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_PLATFORM_PLATFORM_MESSAGE_RESPONSE_DART_H_ 6 #define FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_RESPONSE_DART_H_ 7 8 #include "flutter/fml/message_loop.h" 9 #include "flutter/lib/ui/window/platform_message_response.h" 10 11 namespace flutter { 12 13 class PlatformMessageResponseDart : public PlatformMessageResponse { 14 FML_FRIEND_MAKE_REF_COUNTED(PlatformMessageResponseDart); 15 16 public: 17 // Callable on any thread. 18 void Complete(std::unique_ptr<fml::Mapping> data) override; 19 void CompleteEmpty() override; 20 21 protected: 22 explicit PlatformMessageResponseDart( 23 tonic::DartPersistentValue callback, 24 fml::RefPtr<fml::TaskRunner> ui_task_runner); 25 ~PlatformMessageResponseDart() override; 26 27 tonic::DartPersistentValue callback_; 28 fml::RefPtr<fml::TaskRunner> ui_task_runner_; 29 }; 30 31 } // namespace flutter 32 33 #endif // FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_RESPONSE_DART_H_ 34