OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 SERVICES_LOG_LOG_IMPL_H_ |
| 6 #define SERVICES_LOG_LOG_IMPL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 #include "mojo/services/log/interfaces/entry.mojom.h" |
| 13 #include "mojo/services/log/interfaces/log.mojom.h" |
| 14 |
| 15 namespace mojo { |
| 16 |
| 17 class ApplicationConnection; |
| 18 |
| 19 namespace log { |
| 20 |
| 21 // This is an implementation of the log service |
| 22 // (see mojo/services/log/interfaces/log.mojom). It formats incoming messages |
| 23 // and writes them to the supplied FILE stream. It does not take ownership of |
| 24 // the FILE stream. |
| 25 // |
| 26 // This service implementation binds a new Log implementation for each incoming |
| 27 // application connection. |
| 28 class LogImpl : public Log { |
| 29 public: |
| 30 static void Create(ApplicationConnection* connection, |
| 31 InterfaceRequest<Log> request, |
| 32 FILE* out_file); |
| 33 |
| 34 // |Log| implementation: |
| 35 void AddEntry(EntryPtr entry) override; |
| 36 |
| 37 private: |
| 38 LogImpl(const std::string& remote_url, |
| 39 InterfaceRequest<Log> request, |
| 40 FILE* out_file); |
| 41 ~LogImpl() override; |
| 42 |
| 43 std::string FormatEntry(const EntryPtr& entry); |
| 44 |
| 45 const std::string remote_url_; |
| 46 StrongBinding<Log> binding_; |
| 47 FILE* out_file_; |
| 48 |
| 49 MOJO_DISALLOW_COPY_AND_ASSIGN(LogImpl); |
| 50 }; |
| 51 |
| 52 } // namespace log |
| 53 } // namespace mojo |
| 54 |
| 55 #endif // SERVICES_LOG_LOG_IMPL_H_ |
OLD | NEW |