OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_ | 5 #ifndef SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_ |
6 #define SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_ | 6 #define SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "services/shell/public/cpp/interface_factory.h" | 9 #include "services/shell/public/cpp/interface_factory.h" |
10 #include "services/tracing/public/cpp/trace_provider_impl.h" | 10 #include "services/tracing/public/cpp/trace_provider_impl.h" |
11 #include "services/tracing/public/interfaces/tracing.mojom.h" | 11 #include "services/tracing/public/interfaces/tracing.mojom.h" |
12 | 12 |
13 namespace mojo { | 13 namespace shell { |
14 | |
15 class Connection; | 14 class Connection; |
16 class Connector; | 15 class Connector; |
| 16 } |
| 17 |
| 18 namespace mojo { |
17 | 19 |
18 // Connects to mojo:tracing during your Application's Initialize() call once | 20 // Connects to mojo:tracing during your Application's Initialize() call once |
19 // per process. | 21 // per process. |
20 // | 22 // |
21 // We need to deal with multiple ways of packaging mojo applications | 23 // We need to deal with multiple ways of packaging mojo applications |
22 // together. We'll need to deal with packages that use the mojo.ContentHandler | 24 // together. We'll need to deal with packages that use the mojo.ContentHandler |
23 // interface to bundle several Applciations into a single physical on disk | 25 // interface to bundle several Applciations into a single physical on disk |
24 // mojo binary, and with those same services each in their own mojo binary. | 26 // mojo binary, and with those same services each in their own mojo binary. |
25 // | 27 // |
26 // Have your bundle ContentHandler own a TracingImpl, and each Application own | 28 // Have your bundle ContentHandler own a TracingImpl, and each Application own |
27 // a TracingImpl. In bundles, the second TracingImpl will be a no-op. | 29 // a TracingImpl. In bundles, the second TracingImpl will be a no-op. |
28 class TracingImpl : public InterfaceFactory<tracing::TraceProvider> { | 30 class TracingImpl : public shell::InterfaceFactory<tracing::TraceProvider> { |
29 public: | 31 public: |
30 TracingImpl(); | 32 TracingImpl(); |
31 ~TracingImpl() override; | 33 ~TracingImpl() override; |
32 | 34 |
33 // This connects to the tracing service and registers ourselves to provide | 35 // This connects to the tracing service and registers ourselves to provide |
34 // tracing data on demand. | 36 // tracing data on demand. |
35 void Initialize(Connector* connector, const std::string& url); | 37 void Initialize(shell::Connector* connector, const std::string& url); |
36 | 38 |
37 private: | 39 private: |
38 // InterfaceFactory<tracing::TraceProvider> implementation. | 40 // InterfaceFactory<tracing::TraceProvider> implementation. |
39 void Create(Connection* connection, | 41 void Create(shell::Connection* connection, |
40 InterfaceRequest<tracing::TraceProvider> request) override; | 42 InterfaceRequest<tracing::TraceProvider> request) override; |
41 | 43 |
42 scoped_ptr<Connection> connection_; | 44 scoped_ptr<shell::Connection> connection_; |
43 TraceProviderImpl provider_impl_; | 45 TraceProviderImpl provider_impl_; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(TracingImpl); | 47 DISALLOW_COPY_AND_ASSIGN(TracingImpl); |
46 }; | 48 }; |
47 | 49 |
48 } // namespace mojo | 50 } // namespace mojo |
49 | 51 |
50 #endif // SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_ | 52 #endif // SERVICES_TRACING_PUBLIC_CPP_TRACING_IMPL_H_ |
OLD | NEW |