1class {{export_attribute}} {{interface.name}}StubDispatch { 2 public: 3 static bool Accept({{interface.name}}* impl, mojo::Message* message); 4 static bool AcceptWithResponder( 5 {{interface.name}}* impl, 6 mojo::Message* message, 7 std::unique_ptr<mojo::MessageReceiverWithStatus> responder); 8}; 9 10template <typename ImplRefTraits = 11 mojo::RawPtrImplRefTraits<{{interface.name}}>> 12class {{interface.name}}Stub 13 : public mojo::MessageReceiverWithResponderStatus { 14 public: 15 using ImplPointerType = typename ImplRefTraits::PointerType; 16 17 {{interface.name}}Stub() {} 18 ~{{interface.name}}Stub() override {} 19 20 void set_sink(ImplPointerType sink) { sink_ = std::move(sink); } 21 ImplPointerType& sink() { return sink_; } 22 23 bool Accept(mojo::Message* message) override { 24 if (ImplRefTraits::IsNull(sink_)) 25 return false; 26 return {{interface.name}}StubDispatch::Accept( 27 ImplRefTraits::GetRawPointer(&sink_), message); 28 } 29 30 bool AcceptWithResponder( 31 mojo::Message* message, 32 std::unique_ptr<mojo::MessageReceiverWithStatus> responder) override { 33 if (ImplRefTraits::IsNull(sink_)) 34 return false; 35 return {{interface.name}}StubDispatch::AcceptWithResponder( 36 ImplRefTraits::GetRawPointer(&sink_), message, std::move(responder)); 37 } 38 39 private: 40 ImplPointerType sink_; 41}; 42