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_H_ 6 #define FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_RESPONSE_H_ 7 8 #include <vector> 9 10 #include "flutter/fml/mapping.h" 11 #include "flutter/fml/memory/ref_counted.h" 12 #include "flutter/fml/memory/ref_ptr.h" 13 14 namespace flutter { 15 16 class PlatformMessageResponse 17 : public fml::RefCountedThreadSafe<PlatformMessageResponse> { 18 FML_FRIEND_REF_COUNTED_THREAD_SAFE(PlatformMessageResponse); 19 20 public: 21 // Callable on any thread. 22 virtual void Complete(std::unique_ptr<fml::Mapping> data) = 0; 23 virtual void CompleteEmpty() = 0; 24 is_complete()25 bool is_complete() const { return is_complete_; } 26 27 protected: 28 PlatformMessageResponse(); 29 virtual ~PlatformMessageResponse(); 30 31 bool is_complete_ = false; 32 }; 33 34 } // namespace flutter 35 36 #endif // FLUTTER_LIB_UI_PLATFORM_PLATFORM_MESSAGE_RESPONSE_H_ 37