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

Side by Side Diff: services/log/main.cc

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/log_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #include "base/macros.h" 5 #include <utility>
6
6 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
7 #include "mojo/public/c/system/main.h" 8 #include "mojo/public/c/system/main.h"
8 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
9 #include "mojo/public/cpp/application/application_delegate.h" 10 #include "mojo/public/cpp/application/application_delegate.h"
10 #include "mojo/public/cpp/application/interface_factory.h" 11 #include "mojo/public/cpp/application/interface_factory.h"
11 #include "mojo/services/files/interfaces/files.mojom.h" 12 #include "mojo/public/cpp/system/macros.h"
12 #include "services/files/files_impl.h" 13 #include "mojo/services/log/interfaces/log.mojom.h"
14 #include "services/log/log_impl.h"
13 15
14 namespace mojo { 16 namespace mojo {
15 namespace files { 17 namespace log {
16 18
17 class FilesApp : public ApplicationDelegate, public InterfaceFactory<Files> { 19 // Provides the mojo.log.Log service. Binds a new Log implementation for each
20 // Log interface request.
21 class LogApp : public ApplicationDelegate, public InterfaceFactory<Log> {
18 public: 22 public:
19 FilesApp() {} 23 LogApp() {}
20 ~FilesApp() override {} 24 ~LogApp() override {}
21 25
22 private: 26 private:
23 // |ApplicationDelegate| override: 27 // |ApplicationDelegate| override:
24 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { 28 bool ConfigureIncomingConnection(ApplicationConnection* connection) override {
25 connection->AddService<Files>(this); 29 connection->AddService<Log>(this);
26 return true; 30 return true;
27 } 31 }
28 32
29 // |InterfaceFactory<Files>| implementation: 33 // |InterfaceFactory<Log>| implementation:
34 // We maintain a separate |LogImpl| for each incoming connection.
30 void Create(ApplicationConnection* connection, 35 void Create(ApplicationConnection* connection,
31 InterfaceRequest<Files> request) override { 36 InterfaceRequest<Log> request) override {
32 new FilesImpl(connection, request.Pass()); 37 LogImpl::Create(connection, std::move(request), stderr);
33 } 38 }
34 39
35 DISALLOW_COPY_AND_ASSIGN(FilesApp); 40 MOJO_DISALLOW_COPY_AND_ASSIGN(LogApp);
36 }; 41 };
37 42
38 } // namespace files 43 } // namespace log
39 } // namespace mojo 44 } // namespace mojo
40 45
41 MojoResult MojoMain(MojoHandle application_request) { 46 MojoResult MojoMain(MojoHandle application_request) {
42 mojo::ApplicationRunnerChromium runner(new mojo::files::FilesApp()); 47 mojo::ApplicationRunnerChromium runner(new mojo::log::LogApp());
43 return runner.Run(application_request); 48 return runner.Run(application_request);
44 } 49 }
OLDNEW
« no previous file with comments | « services/log/log_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698