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

Side by Side Diff: shell/context.cc

Issue 1284293003: Rename tracing interfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 months 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/tracing/tracing_app.cc ('k') | shell/tracer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "shell/context.h" 5 #include "shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/run_loop.h" 19 #include "base/run_loop.h"
20 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/trace_event/trace_event.h" 22 #include "base/trace_event/trace_event.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "mojo/common/trace_controller_impl.h" 24 #include "mojo/common/trace_provider_impl.h"
25 #include "mojo/common/tracing_impl.h" 25 #include "mojo/common/tracing_impl.h"
26 #include "mojo/edk/embedder/embedder.h" 26 #include "mojo/edk/embedder/embedder.h"
27 #include "mojo/edk/embedder/simple_platform_support.h" 27 #include "mojo/edk/embedder/simple_platform_support.h"
28 #include "mojo/public/cpp/application/application_connection.h" 28 #include "mojo/public/cpp/application/application_connection.h"
29 #include "mojo/public/cpp/application/application_delegate.h" 29 #include "mojo/public/cpp/application/application_delegate.h"
30 #include "mojo/public/cpp/application/application_impl.h" 30 #include "mojo/public/cpp/application/application_impl.h"
31 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 31 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
32 #include "shell/application_manager/application_loader.h" 32 #include "shell/application_manager/application_loader.h"
33 #include "shell/application_manager/application_manager.h" 33 #include "shell/application_manager/application_manager.h"
34 #include "shell/background_application_loader.h" 34 #include "shell/background_application_loader.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 class TracingServiceProvider : public ServiceProvider { 187 class TracingServiceProvider : public ServiceProvider {
188 public: 188 public:
189 TracingServiceProvider(Tracer* tracer, 189 TracingServiceProvider(Tracer* tracer,
190 mojo::InterfaceRequest<ServiceProvider> request) 190 mojo::InterfaceRequest<ServiceProvider> request)
191 : tracer_(tracer), binding_(this, request.Pass()) {} 191 : tracer_(tracer), binding_(this, request.Pass()) {}
192 ~TracingServiceProvider() override {} 192 ~TracingServiceProvider() override {}
193 193
194 void ConnectToService(const mojo::String& service_name, 194 void ConnectToService(const mojo::String& service_name,
195 mojo::ScopedMessagePipeHandle client_handle) override { 195 mojo::ScopedMessagePipeHandle client_handle) override {
196 if (tracer_ && service_name == tracing::TraceController::Name_) { 196 if (tracer_ && service_name == tracing::TraceProvider::Name_) {
197 tracer_->ConnectToController( 197 tracer_->ConnectToProvider(
198 mojo::MakeRequest<tracing::TraceController>(client_handle.Pass())); 198 mojo::MakeRequest<tracing::TraceProvider>(client_handle.Pass()));
199 } 199 }
200 } 200 }
201 201
202 private: 202 private:
203 Tracer* tracer_; 203 Tracer* tracer_;
204 mojo::StrongBinding<mojo::ServiceProvider> binding_; 204 mojo::StrongBinding<mojo::ServiceProvider> binding_;
205 205
206 DISALLOW_COPY_AND_ASSIGN(TracingServiceProvider); 206 DISALLOW_COPY_AND_ASSIGN(TracingServiceProvider);
207 }; 207 };
208 208
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 ServiceProviderPtr tracing_services; 306 ServiceProviderPtr tracing_services;
307 ServiceProviderPtr tracing_exposed_services; 307 ServiceProviderPtr tracing_exposed_services;
308 new TracingServiceProvider(tracer_, GetProxy(&tracing_exposed_services)); 308 new TracingServiceProvider(tracer_, GetProxy(&tracing_exposed_services));
309 application_manager_.ConnectToApplication( 309 application_manager_.ConnectToApplication(
310 GURL("mojo:tracing"), GURL(""), GetProxy(&tracing_services), 310 GURL("mojo:tracing"), GURL(""), GetProxy(&tracing_services),
311 tracing_exposed_services.Pass(), base::Closure()); 311 tracing_exposed_services.Pass(), base::Closure());
312 312
313 if (command_line.HasSwitch(switches::kTraceStartup)) { 313 if (command_line.HasSwitch(switches::kTraceStartup)) {
314 DCHECK(tracer_); 314 DCHECK(tracer_);
315 tracing::TraceCoordinatorPtr coordinator; 315 tracing::TraceCollectorPtr coordinator;
316 auto coordinator_request = GetProxy(&coordinator); 316 auto coordinator_request = GetProxy(&coordinator);
317 tracing_services->ConnectToService(tracing::TraceCoordinator::Name_, 317 tracing_services->ConnectToService(tracing::TraceCollector::Name_,
318 coordinator_request.PassMessagePipe()); 318 coordinator_request.PassMessagePipe());
319 tracer_->StartCollectingFromTracingService(coordinator.Pass()); 319 tracer_->StartCollectingFromTracingService(coordinator.Pass());
320 } 320 }
321 321
322 return true; 322 return true;
323 } 323 }
324 324
325 void Context::Shutdown() { 325 void Context::Shutdown() {
326 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); 326 TRACE_EVENT0("mojo_shell", "Context::Shutdown");
327 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 327 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 app_urls_.erase(url); 364 app_urls_.erase(url);
365 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { 365 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) {
366 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 366 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
367 task_runners_->shell_runner()); 367 task_runners_->shell_runner());
368 base::MessageLoop::current()->Quit(); 368 base::MessageLoop::current()->Quit();
369 } 369 }
370 } 370 }
371 } 371 }
372 372
373 } // namespace shell 373 } // namespace shell
OLDNEW
« no previous file with comments | « services/tracing/tracing_app.cc ('k') | shell/tracer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698