1 // Copyright 2018 The Chromium 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 MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_DUMPER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_DUMPER_H_ 7 8 #include "base/files/file_path.h" 9 #include "mojo/public/cpp/bindings/message.h" 10 #include "mojo/public/cpp/bindings/message_dumper.h" 11 12 namespace mojo { 13 14 class MessageDumper : public mojo::MessageReceiver { 15 public: 16 MessageDumper(); 17 ~MessageDumper() override; 18 19 bool Accept(mojo::Message* message) override; 20 21 struct MessageEntry { 22 MessageEntry(const uint8_t* data, 23 uint32_t data_size, 24 const char* interface_name, 25 const char* method_name); 26 MessageEntry(const MessageEntry& entry); 27 ~MessageEntry(); 28 29 const char* interface_name; 30 const char* method_name; 31 std::vector<uint8_t> data_bytes; 32 }; 33 34 static void SetMessageDumpDirectory(const base::FilePath& directory); 35 static const base::FilePath& GetMessageDumpDirectory(); 36 37 private: 38 uint32_t identifier_; 39 }; 40 41 } // namespace mojo 42 43 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_DUMPER_H_ 44