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