OLD | NEW |
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 "services/dart/dart_tracing.h" | 5 #include "services/dart/dart_tracing.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "dart/runtime/include/dart_tools_api.h" | 9 #include "dart/runtime/include/dart_tools_api.h" |
8 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
9 | 11 |
10 namespace dart { | 12 namespace dart { |
11 | 13 |
12 void DartTimelineController::Enable(const mojo::String& categories) { | 14 void DartTimelineController::Enable(const mojo::String& categories) { |
13 if (categories == mojo::String("Dart")) { | 15 if (categories == mojo::String("Dart")) { |
14 Dart_GlobalTimelineSetRecordedStreams(DART_TIMELINE_STREAM_DART); | 16 Dart_GlobalTimelineSetRecordedStreams(DART_TIMELINE_STREAM_DART); |
15 } else { | 17 } else { |
16 // TODO(johnmccutchan): Respect |categories|. | 18 // TODO(johnmccutchan): Respect |categories|. |
(...skipping 20 matching lines...) Expand all Loading... |
37 void DartTraceProvider::Bind( | 39 void DartTraceProvider::Bind( |
38 mojo::InterfaceRequest<tracing::TraceProvider> request) { | 40 mojo::InterfaceRequest<tracing::TraceProvider> request) { |
39 if (!binding_.is_bound()) { | 41 if (!binding_.is_bound()) { |
40 binding_.Bind(request.Pass()); | 42 binding_.Bind(request.Pass()); |
41 } else { | 43 } else { |
42 LOG(ERROR) << "Cannot accept two connections to TraceProvider."; | 44 LOG(ERROR) << "Cannot accept two connections to TraceProvider."; |
43 } | 45 } |
44 } | 46 } |
45 | 47 |
46 // tracing::TraceProvider implementation: | 48 // tracing::TraceProvider implementation: |
47 void DartTraceProvider::StartTracing(const mojo::String& categories, | 49 void DartTraceProvider::StartTracing( |
48 tracing::TraceRecorderPtr recorder) { | 50 const mojo::String& categories, |
| 51 mojo::InterfaceHandle<tracing::TraceRecorder> recorder) { |
49 DCHECK(!recorder_.get()); | 52 DCHECK(!recorder_.get()); |
50 recorder_ = recorder.Pass(); | 53 recorder_ = tracing::TraceRecorderPtr::Create(std::move(recorder)); |
51 DartTimelineController::Enable(categories); | 54 DartTimelineController::Enable(categories); |
52 } | 55 } |
53 | 56 |
54 static void AppendStreamConsumer(Dart_StreamConsumer_State state, | 57 static void AppendStreamConsumer(Dart_StreamConsumer_State state, |
55 const char* stream_name, | 58 const char* stream_name, |
56 const uint8_t* buffer, | 59 const uint8_t* buffer, |
57 intptr_t buffer_length, | 60 intptr_t buffer_length, |
58 void* user_data) { | 61 void* user_data) { |
59 if (state == Dart_StreamConsumer_kFinish) { | 62 if (state == Dart_StreamConsumer_kFinish) { |
60 return; | 63 return; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 connection->AddService(this); | 134 connection->AddService(this); |
132 } | 135 } |
133 | 136 |
134 void DartTracingImpl::Create( | 137 void DartTracingImpl::Create( |
135 mojo::ApplicationConnection* connection, | 138 mojo::ApplicationConnection* connection, |
136 mojo::InterfaceRequest<tracing::TraceProvider> request) { | 139 mojo::InterfaceRequest<tracing::TraceProvider> request) { |
137 provider_impl_.Bind(request.Pass()); | 140 provider_impl_.Bind(request.Pass()); |
138 } | 141 } |
139 | 142 |
140 } // namespace dart | 143 } // namespace dart |
OLD | NEW |