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

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

Issue 1334213002: Support for tracing app initialization. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Change BindingSet to Binding Created 5 years, 3 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 | « no previous file | mojo/common/BUILD.gn » ('j') | mojo/common/BUILD.gn » ('J')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 kDoWorkDelay); 45 kDoWorkDelay);
46 } 46 }
47 47
48 class TraceMeApp : public mojo::ApplicationDelegate { 48 class TraceMeApp : public mojo::ApplicationDelegate {
49 public: 49 public:
50 TraceMeApp() {} 50 TraceMeApp() {}
51 ~TraceMeApp() override {} 51 ~TraceMeApp() override {}
52 52
53 // mojo:ApplicationDelegate: 53 // mojo:ApplicationDelegate:
54 void Initialize(mojo::ApplicationImpl* app) override { 54 void Initialize(mojo::ApplicationImpl* app) override {
55 TRACE_EVENT0("trace_me", "TraceMeApp::Initialize");
56
57 // Allow TracingImpl to connect to the central tracing service, advertising 55 // Allow TracingImpl to connect to the central tracing service, advertising
58 // its ability to provide trace events. 56 // its ability to provide trace events.
59 tracing_.Initialize(app); 57 tracing_.Initialize(app);
60 58
59 TRACE_EVENT0("trace_me", "TraceMeApp::Initialize");
60
61 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&DoWork)); 61 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&DoWork));
62 } 62 }
63 63
64 private: 64 private:
65 mojo::TracingImpl tracing_; 65 mojo::TracingImpl tracing_;
66 DISALLOW_COPY_AND_ASSIGN(TraceMeApp); 66 DISALLOW_COPY_AND_ASSIGN(TraceMeApp);
67 }; 67 };
68 68
69 } // namespace examples 69 } // namespace examples
70 70
71 MojoResult MojoMain(MojoHandle application_request) { 71 MojoResult MojoMain(MojoHandle application_request) {
72 mojo::ApplicationRunnerChromium runner(new examples::TraceMeApp); 72 mojo::ApplicationRunnerChromium runner(new examples::TraceMeApp);
73 return runner.Run(application_request); 73 return runner.Run(application_request);
74 } 74 }
OLDNEW
« no previous file with comments | « no previous file | mojo/common/BUILD.gn » ('j') | mojo/common/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698