| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_SERVICES_FLOG_FLOG_LOGGER_IMPL_H_ | 5 #ifndef MOJO_SERVICES_FLOG_FLOG_LOGGER_IMPL_H_ |
| 6 #define MOJO_SERVICES_FLOG_FLOG_LOGGER_IMPL_H_ | 6 #define MOJO_SERVICES_FLOG_FLOG_LOGGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
| 12 #include "mojo/services/flog/interfaces/flog.mojom.h" |
| 12 #include "services/flog/flog_directory.h" | 13 #include "services/flog/flog_directory.h" |
| 13 #include "services/flog/flog_service_impl.h" | 14 #include "services/flog/flog_service_impl.h" |
| 14 | 15 |
| 15 namespace mojo { | 16 namespace mojo { |
| 16 namespace flog { | 17 namespace flog { |
| 17 | 18 |
| 18 // FlogLogger implementation. | 19 // FlogLogger implementation. |
| 19 class FlogLoggerImpl : public FlogServiceImpl::ProductBase, | 20 class FlogLoggerImpl : public FlogServiceImpl::ProductBase, |
| 20 MessageReceiverWithResponderStatus { | 21 private MessageReceiverWithResponderStatus, |
| 22 private FlogLogger { |
| 21 public: | 23 public: |
| 22 static std::shared_ptr<FlogLoggerImpl> Create( | 24 static std::shared_ptr<FlogLoggerImpl> Create( |
| 23 InterfaceRequest<FlogLogger> request, | 25 InterfaceRequest<FlogLogger> request, |
| 24 uint32_t log_id, | 26 uint32_t log_id, |
| 25 const std::string& label, | 27 const std::string& label, |
| 26 std::shared_ptr<FlogDirectory> directory, | 28 std::shared_ptr<FlogDirectory> directory, |
| 27 FlogServiceImpl* owner); | 29 FlogServiceImpl* owner); |
| 28 | 30 |
| 29 ~FlogLoggerImpl() override; | 31 ~FlogLoggerImpl() override; |
| 30 | 32 |
| 31 // MessageReceiverWithResponderStatus implementation. | |
| 32 bool Accept(Message* message) override; | |
| 33 | |
| 34 bool AcceptWithResponder(Message* message, | |
| 35 MessageReceiverWithStatus* responder) override; | |
| 36 | |
| 37 private: | 33 private: |
| 38 FlogLoggerImpl(InterfaceRequest<FlogLogger> request, | 34 FlogLoggerImpl(InterfaceRequest<FlogLogger> request, |
| 39 uint32_t log_id, | 35 uint32_t log_id, |
| 40 const std::string& label, | 36 const std::string& label, |
| 41 std::shared_ptr<FlogDirectory> directory, | 37 std::shared_ptr<FlogDirectory> directory, |
| 42 FlogServiceImpl* owner); | 38 FlogServiceImpl* owner); |
| 43 | 39 |
| 44 void WriteData(uint32_t data_size, const void* data); | 40 void WriteData(uint32_t data_size, const void* data); |
| 45 | 41 |
| 42 // MessageReceiverWithResponderStatus implementation. |
| 43 bool Accept(Message* message) override; |
| 44 |
| 45 bool AcceptWithResponder(Message* message, |
| 46 MessageReceiverWithStatus* responder) override; |
| 47 |
| 48 // FlogLogger implementation (called by stub_). |
| 49 void LogMojoLoggerMessage(int64_t time_us, |
| 50 int32_t log_level, |
| 51 const String& message, |
| 52 const String& source_file, |
| 53 uint32_t source_line) override; |
| 54 |
| 55 void LogChannelCreation(int64_t time_us, |
| 56 uint32_t channel_id, |
| 57 const String& type_name) override; |
| 58 |
| 59 void LogChannelMessage(int64_t time_us, |
| 60 uint32_t channel_id, |
| 61 mojo::Array<uint8_t> data) override; |
| 62 |
| 63 void LogChannelDeletion(int64_t time_us, uint32_t channel_id) override; |
| 64 |
| 46 std::unique_ptr<mojo::internal::Router> router_; | 65 std::unique_ptr<mojo::internal::Router> router_; |
| 47 files::FilePtr file_; | 66 files::FilePtr file_; |
| 67 FlogLoggerStub stub_; |
| 48 }; | 68 }; |
| 49 | 69 |
| 50 } // namespace flog | 70 } // namespace flog |
| 51 } // namespace mojo | 71 } // namespace mojo |
| 52 | 72 |
| 53 #endif // MOJO_SERVICES_FLOG_FLOG_LOGGER_IMPL_H_ | 73 #endif // MOJO_SERVICES_FLOG_FLOG_LOGGER_IMPL_H_ |
| OLD | NEW |