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