Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Side by Side Diff: services/log/log_impl.h

Issue 1447273002: Mojo Log service and a thread-safe client library. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: initialize global variables at start of the test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/log/BUILD.gn ('k') | services/log/log_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 <stdio.h>
9
10 #include <string>
11
12 #include "base/macros.h"
13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
15 #include "mojo/services/log/interfaces/entry.mojom.h"
16 #include "mojo/services/log/interfaces/log.mojom.h"
17
18 namespace mojo {
19
20 class ApplicationConnection;
21
22 namespace log {
23
24 // This is an implementation of the log service
25 // (see mojo/services/log/interfaces/log.mojom). It formats incoming messages
26 // and writes them to the supplied FILE stream. It does not take ownership of
27 // the FILE stream.
28 //
29 // This service implementation binds a new Log implementation for each incoming
30 // application connection.
31 class LogImpl : public Log {
32 public:
33 // LogImpl does not take ownership of |out_file|, so |out_file| must live for
34 // the duration of the incoming connection (which is left undefined).
35 static void Create(ApplicationConnection* connection,
36 InterfaceRequest<Log> request,
37 FILE* out_file);
38
39 // |Log| implementation:
40 void AddEntry(EntryPtr entry) override;
41
42 private:
43 LogImpl(const std::string& remote_url,
44 InterfaceRequest<Log> request,
45 FILE* out_file);
46 ~LogImpl() override;
47
48 std::string FormatEntry(const EntryPtr& entry);
49
50 const std::string remote_url_;
51 StrongBinding<Log> binding_;
52 FILE* out_file_;
53
54 DISALLOW_COPY_AND_ASSIGN(LogImpl);
55 };
56
57 } // namespace log
58 } // namespace mojo
59
60 #endif // SERVICES_LOG_LOG_IMPL_H_
OLDNEW
« no previous file with comments | « services/log/BUILD.gn ('k') | services/log/log_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698