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

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

Issue 687273002: mojo: Update content handler API (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Add missing comment Created 6 years, 1 month 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/viewer/document_view.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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "base/threading/thread.h" 6 #include "base/threading/thread.h"
7 #include "mojo/application/application_runner_chromium.h" 7 #include "mojo/application/application_runner_chromium.h"
8 #include "mojo/public/c/system/main.h" 8 #include "mojo/public/c/system/main.h"
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/application_delegate.h" 10 #include "mojo/public/cpp/application/application_delegate.h"
(...skipping 15 matching lines...) Expand all
26 class Viewer : public mojo::ApplicationDelegate, 26 class Viewer : public mojo::ApplicationDelegate,
27 public mojo::InterfaceFactory<mojo::ContentHandler> { 27 public mojo::InterfaceFactory<mojo::ContentHandler> {
28 public: 28 public:
29 Viewer() : compositor_thread_("compositor thread") {} 29 Viewer() : compositor_thread_("compositor thread") {}
30 30
31 virtual ~Viewer() { blink::shutdown(); } 31 virtual ~Viewer() { blink::shutdown(); }
32 32
33 private: 33 private:
34 // Overridden from ApplicationDelegate: 34 // Overridden from ApplicationDelegate:
35 virtual void Initialize(mojo::ApplicationImpl* app) override { 35 virtual void Initialize(mojo::ApplicationImpl* app) override {
36 shell_ = app->shell();
37 platform_impl_.reset(new PlatformImpl(app)); 36 platform_impl_.reset(new PlatformImpl(app));
38 blink::initialize(platform_impl_.get()); 37 blink::initialize(platform_impl_.get());
39 // FIXME: Why not in the component build? 38 // FIXME: Why not in the component build?
40 #if !defined(COMPONENT_BUILD) 39 #if !defined(COMPONENT_BUILD)
41 base::i18n::InitializeICU(); 40 base::i18n::InitializeICU();
42 #endif 41 #endif
43 compositor_thread_.Start(); 42 compositor_thread_.Start();
44 } 43 }
45 44
46 virtual bool ConfigureIncomingConnection( 45 virtual bool ConfigureIncomingConnection(
47 mojo::ApplicationConnection* connection) override { 46 mojo::ApplicationConnection* connection) override {
48 connection->AddService(this); 47 connection->AddService(this);
49 connection->AddService(&tracing_); 48 connection->AddService(&tracing_);
50 return true; 49 return true;
51 } 50 }
52 51
53 // Overridden from InterfaceFactory<ContentHandler> 52 // Overridden from InterfaceFactory<ContentHandler>
54 virtual void Create(mojo::ApplicationConnection* connection, 53 virtual void Create(mojo::ApplicationConnection* connection,
55 mojo::InterfaceRequest<mojo::ContentHandler> request) over ride { 54 mojo::InterfaceRequest<mojo::ContentHandler> request) over ride {
56 mojo::BindToRequest( 55 mojo::BindToRequest(
57 new ContentHandlerImpl(shell_, compositor_thread_.message_loop_proxy()), 56 new ContentHandlerImpl(compositor_thread_.message_loop_proxy()),
58 &request); 57 &request);
59 } 58 }
60 59
61 scoped_ptr<PlatformImpl> platform_impl_; 60 scoped_ptr<PlatformImpl> platform_impl_;
62 mojo::Shell* shell_;
63 base::Thread compositor_thread_; 61 base::Thread compositor_thread_;
64 62
65 TracingFactory tracing_; 63 TracingFactory tracing_;
66 64
67 DISALLOW_COPY_AND_ASSIGN(Viewer); 65 DISALLOW_COPY_AND_ASSIGN(Viewer);
68 }; 66 };
69 67
70 } // namespace mojo 68 } // namespace mojo
71 69
72 MojoResult MojoMain(MojoHandle shell_handle) { 70 MojoResult MojoMain(MojoHandle shell_handle) {
73 mojo::ApplicationRunnerChromium runner(new sky::Viewer); 71 mojo::ApplicationRunnerChromium runner(new sky::Viewer);
74 return runner.Run(shell_handle); 72 return runner.Run(shell_handle);
75 } 73 }
OLDNEW
« no previous file with comments | « sky/viewer/document_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698