OLD | NEW |
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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "mojo/examples/sample_app/gles2_client_impl.h" | 10 #include "mojo/examples/sample_app/gles2_client_impl.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 public mojo::NativeViewportClient { | 25 public mojo::NativeViewportClient { |
26 public: | 26 public: |
27 SampleApp() : weak_factory_(this) {} | 27 SampleApp() : weak_factory_(this) {} |
28 | 28 |
29 virtual ~SampleApp() { | 29 virtual ~SampleApp() { |
30 // TODO(darin): Fix shutdown so we don't need to leak this. | 30 // TODO(darin): Fix shutdown so we don't need to leak this. |
31 mojo_ignore_result(gles2_client_.release()); | 31 mojo_ignore_result(gles2_client_.release()); |
32 } | 32 } |
33 | 33 |
34 virtual void Initialize(mojo::ApplicationImpl* app) override { | 34 virtual void Initialize(mojo::ApplicationImpl* app) override { |
35 app->ConnectToService("mojo:mojo_native_viewport_service", &viewport_); | 35 app->ConnectToService("mojo:native_viewport_service", &viewport_); |
36 viewport_.set_client(this); | 36 viewport_.set_client(this); |
37 | 37 |
38 // TODO(jamesr): Should be mojo:mojo_gpu_service | 38 // TODO(jamesr): Should be mojo:gpu_service |
39 app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_); | 39 app->ConnectToService("mojo:native_viewport_service", &gpu_service_); |
40 | 40 |
41 mojo::SizePtr size(mojo::Size::New()); | 41 mojo::SizePtr size(mojo::Size::New()); |
42 size->width = 800; | 42 size->width = 800; |
43 size->height = 600; | 43 size->height = 600; |
44 viewport_->Create(size.Pass(), | 44 viewport_->Create(size.Pass(), |
45 base::Bind(&SampleApp::OnCreatedNativeViewport, | 45 base::Bind(&SampleApp::OnCreatedNativeViewport, |
46 weak_factory_.GetWeakPtr())); | 46 weak_factory_.GetWeakPtr())); |
47 viewport_->Show(); | 47 viewport_->Show(); |
48 } | 48 } |
49 | 49 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 83 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace examples | 86 } // namespace examples |
87 | 87 |
88 MojoResult MojoMain(MojoHandle shell_handle) { | 88 MojoResult MojoMain(MojoHandle shell_handle) { |
89 mojo::ApplicationRunner runner(new examples::SampleApp); | 89 mojo::ApplicationRunner runner(new examples::SampleApp); |
90 return runner.Run(shell_handle); | 90 return runner.Run(shell_handle); |
91 } | 91 } |
OLD | NEW |