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/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/examples/compositor_app/compositor_host.h" | 9 #include "mojo/examples/compositor_app/compositor_host.h" |
10 #include "mojo/public/cpp/application/application.h" | 10 #include "mojo/public/cpp/application/application.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 SampleApp() {} | 23 SampleApp() {} |
24 virtual ~SampleApp() {} | 24 virtual ~SampleApp() {} |
25 | 25 |
26 virtual void Initialize() OVERRIDE { | 26 virtual void Initialize() OVERRIDE { |
27 ConnectTo("mojo:mojo_native_viewport_service", &viewport_); | 27 ConnectTo("mojo:mojo_native_viewport_service", &viewport_); |
28 viewport_.set_client(this); | 28 viewport_.set_client(this); |
29 | 29 |
30 viewport_->Create(Rect::From(gfx::Rect(10, 10, 800, 600))); | 30 viewport_->Create(Rect::From(gfx::Rect(10, 10, 800, 600))); |
31 viewport_->Show(); | 31 viewport_->Show(); |
32 | 32 |
33 MessagePipe gles2_pipe; | 33 MessagePipe pipe; |
34 viewport_->CreateGLES2Context(gles2_pipe.handle0.Pass()); | 34 viewport_->CreateGLES2Context( |
35 host_.reset(new CompositorHost(gles2_pipe.handle1.Pass())); | 35 MakeRequest<CommandBuffer>(pipe.handle0.Pass())); |
| 36 host_.reset(new CompositorHost(pipe.handle1.Pass())); |
36 } | 37 } |
37 | 38 |
38 virtual void OnCreated() OVERRIDE { | 39 virtual void OnCreated() OVERRIDE { |
39 } | 40 } |
40 | 41 |
41 virtual void OnDestroyed() OVERRIDE { | 42 virtual void OnDestroyed() OVERRIDE { |
42 base::MessageLoop::current()->Quit(); | 43 base::MessageLoop::current()->Quit(); |
43 } | 44 } |
44 | 45 |
45 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE { | 46 virtual void OnBoundsChanged(RectPtr bounds) OVERRIDE { |
(...skipping 13 matching lines...) Expand all Loading... |
59 }; | 60 }; |
60 | 61 |
61 } // namespace examples | 62 } // namespace examples |
62 | 63 |
63 // static | 64 // static |
64 Application* Application::Create() { | 65 Application* Application::Create() { |
65 return new examples::SampleApp(); | 66 return new examples::SampleApp(); |
66 } | 67 } |
67 | 68 |
68 } // namespace mojo | 69 } // namespace mojo |
OLD | NEW |