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

Side by Side Diff: examples/trace_me/trace_me_app.cc

Issue 2014043002: Make TracingImpl take a Shell* and args, instead of an ApplicationImpl*. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 | « examples/echo/echo_benchmark.cc ('k') | mojo/common/tracing_impl.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 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/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 class TraceMeApp : public mojo::ApplicationDelegate { 47 class TraceMeApp : public mojo::ApplicationDelegate {
48 public: 48 public:
49 TraceMeApp() {} 49 TraceMeApp() {}
50 ~TraceMeApp() override {} 50 ~TraceMeApp() override {}
51 51
52 // mojo:ApplicationDelegate: 52 // mojo:ApplicationDelegate:
53 void Initialize(mojo::ApplicationImpl* app) override { 53 void Initialize(mojo::ApplicationImpl* app) override {
54 // Allow TracingImpl to connect to the central tracing service, advertising 54 // Allow TracingImpl to connect to the central tracing service, advertising
55 // its ability to provide trace events. 55 // its ability to provide trace events.
56 tracing_.Initialize(app); 56 tracing_.Initialize(app->shell(), &app->args());
57 57
58 TRACE_EVENT0("trace_me", "initialized"); 58 TRACE_EVENT0("trace_me", "initialized");
59 59
60 base::MessageLoop::current()->PostDelayedTask( 60 base::MessageLoop::current()->PostDelayedTask(
61 FROM_HERE, base::Bind(&DoWork), kDoWorkDelay); 61 FROM_HERE, base::Bind(&DoWork), kDoWorkDelay);
62 } 62 }
63 63
64 // mojo:ApplicationDelegate: 64 // mojo:ApplicationDelegate:
65 bool ConfigureIncomingConnection( 65 bool ConfigureIncomingConnection(
66 mojo::ServiceProviderImpl* service_provider_impl) override { 66 mojo::ServiceProviderImpl* service_provider_impl) override {
67 TRACE_EVENT0("trace_me", "connected"); 67 TRACE_EVENT0("trace_me", "connected");
68 return true; 68 return true;
69 } 69 }
70 70
71 private: 71 private:
72 mojo::TracingImpl tracing_; 72 mojo::TracingImpl tracing_;
73 DISALLOW_COPY_AND_ASSIGN(TraceMeApp); 73 DISALLOW_COPY_AND_ASSIGN(TraceMeApp);
74 }; 74 };
75 75
76 } // namespace examples 76 } // namespace examples
77 77
78 MojoResult MojoMain(MojoHandle application_request) { 78 MojoResult MojoMain(MojoHandle application_request) {
79 mojo::ApplicationRunnerChromium runner(new examples::TraceMeApp); 79 mojo::ApplicationRunnerChromium runner(new examples::TraceMeApp);
80 return runner.Run(application_request); 80 return runner.Run(application_request);
81 } 81 }
OLDNEW
« no previous file with comments | « examples/echo/echo_benchmark.cc ('k') | mojo/common/tracing_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698