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

Side by Side Diff: sky/viewer/viewer.cc

Issue 769963004: Add tracing service and make the shell+sky_viewer+services talk to it (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/tools/debugger/prompt/prompt.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/threading/thread.h" 7 #include "base/threading/thread.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/common/tracing_impl.h" 9 #include "mojo/common/tracing_impl.h"
10 #include "mojo/public/c/system/main.h" 10 #include "mojo/public/c/system/main.h"
11 #include "mojo/public/cpp/application/application_connection.h" 11 #include "mojo/public/cpp/application/application_connection.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/application_impl.h" 13 #include "mojo/public/cpp/application/application_impl.h"
14 #include "mojo/public/cpp/application/interface_factory_impl.h" 14 #include "mojo/public/cpp/application/interface_factory_impl.h"
15 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" 15 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h"
16 #include "sky/engine/public/web/Sky.h" 16 #include "sky/engine/public/web/Sky.h"
17 #include "sky/viewer/content_handler_impl.h" 17 #include "sky/viewer/content_handler_impl.h"
18 #include "sky/viewer/document_view.h" 18 #include "sky/viewer/document_view.h"
19 #include "sky/viewer/platform/platform_impl.h" 19 #include "sky/viewer/platform/platform_impl.h"
20 20
21 #if !defined(COMPONENT_BUILD) 21 #if !defined(COMPONENT_BUILD)
22 #include "base/i18n/icu_util.h" 22 #include "base/i18n/icu_util.h"
23 #endif 23 #endif
24 24
25 namespace sky { 25 namespace sky {
26 26
27 class Viewer : public mojo::ApplicationDelegate, 27 class Viewer : public mojo::ApplicationDelegate,
28 public mojo::InterfaceFactory<mojo::ContentHandler>, 28 public mojo::InterfaceFactory<mojo::ContentHandler> {
29 public mojo::InterfaceFactory<mojo::Tracing> {
30 public: 29 public:
31 Viewer() {} 30 Viewer() {}
32 31
33 virtual ~Viewer() { blink::shutdown(); } 32 virtual ~Viewer() { blink::shutdown(); }
34 33
35 private: 34 private:
36 // Overridden from ApplicationDelegate: 35 // Overridden from ApplicationDelegate:
37 virtual void Initialize(mojo::ApplicationImpl* app) override { 36 virtual void Initialize(mojo::ApplicationImpl* app) override {
38 platform_impl_.reset(new PlatformImpl(app)); 37 platform_impl_.reset(new PlatformImpl(app));
39 blink::initialize(platform_impl_.get()); 38 blink::initialize(platform_impl_.get());
40 base::i18n::InitializeICU(); 39 base::i18n::InitializeICU();
40
41 mojo::TracingImpl::Create(app);
41 } 42 }
42 43
43 virtual bool ConfigureIncomingConnection( 44 virtual bool ConfigureIncomingConnection(
44 mojo::ApplicationConnection* connection) override { 45 mojo::ApplicationConnection* connection) override {
45 connection->AddService<mojo::ContentHandler>(this); 46 connection->AddService<mojo::ContentHandler>(this);
46 connection->AddService<mojo::Tracing>(this);
47 return true; 47 return true;
48 } 48 }
49 49
50 // Overridden from InterfaceFactory<ContentHandler> 50 // Overridden from InterfaceFactory<ContentHandler>
51 virtual void Create(mojo::ApplicationConnection* connection, 51 virtual void Create(mojo::ApplicationConnection* connection,
52 mojo::InterfaceRequest<mojo::ContentHandler> request) over ride { 52 mojo::InterfaceRequest<mojo::ContentHandler> request) over ride {
53 mojo::BindToRequest(new ContentHandlerImpl(), &request); 53 mojo::BindToRequest(new ContentHandlerImpl(), &request);
54 } 54 }
55 55
56 // Overridden from InterfaceFactory<Tracing>
57 virtual void Create(mojo::ApplicationConnection* connection,
58 mojo::InterfaceRequest<mojo::Tracing> request) override {
59 new mojo::TracingImpl(request.Pass(), FILE_PATH_LITERAL("sky_viewer"));
60 }
61
62 scoped_ptr<PlatformImpl> platform_impl_; 56 scoped_ptr<PlatformImpl> platform_impl_;
63 57
64 DISALLOW_COPY_AND_ASSIGN(Viewer); 58 DISALLOW_COPY_AND_ASSIGN(Viewer);
65 }; 59 };
66 60
67 } // namespace mojo 61 } // namespace mojo
68 62
69 MojoResult MojoMain(MojoHandle shell_handle) { 63 MojoResult MojoMain(MojoHandle shell_handle) {
70 mojo::ApplicationRunnerChromium runner(new sky::Viewer); 64 mojo::ApplicationRunnerChromium runner(new sky::Viewer);
71 return runner.Run(shell_handle); 65 return runner.Run(shell_handle);
72 } 66 }
OLDNEW
« no previous file with comments | « sky/tools/debugger/prompt/prompt.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698