| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "mojo/examples/compositor_app/compositor_host.h" | 9 #include "mojo/examples/compositor_app/compositor_host.h" |
| 10 #include "mojo/examples/compositor_app/gles2_client_impl.h" | 10 #include "mojo/examples/compositor_app/gles2_client_impl.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 CreateMessagePipe(&gles2_handle, &gles2_client_handle); | 55 CreateMessagePipe(&gles2_handle, &gles2_client_handle); |
| 56 | 56 |
| 57 gles2_client_.reset(new GLES2ClientImpl( | 57 gles2_client_.reset(new GLES2ClientImpl( |
| 58 gles2_handle.Pass(), | 58 gles2_handle.Pass(), |
| 59 base::Bind(&NativeViewportClientImpl::DidCreateContext, | 59 base::Bind(&NativeViewportClientImpl::DidCreateContext, |
| 60 base::Unretained(this)))); | 60 base::Unretained(this)))); |
| 61 viewport_->CreateGLES2Context(gles2_client_handle.Pass()); | 61 viewport_->CreateGLES2Context(gles2_client_handle.Pass()); |
| 62 host_.reset(new CompositorHost(gles2_client_.get())); | 62 host_.reset(new CompositorHost(gles2_client_.get())); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DidCreateContext(gfx::Size viewport_size) { | 65 void DidCreateContext() { |
| 66 host_->DidCreateContext(viewport_size); | 66 host_->DidCreateContext(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual ~NativeViewportClientImpl() {} | 69 virtual ~NativeViewportClientImpl() {} |
| 70 | 70 |
| 71 virtual void OnCreated() MOJO_OVERRIDE { | 71 virtual void OnCreated(uint32_t width, uint32_t height) MOJO_OVERRIDE { |
| 72 host_->SetSize(gfx::Size(width, height)); |
| 72 } | 73 } |
| 73 | 74 |
| 74 virtual void OnDestroyed() MOJO_OVERRIDE { | 75 virtual void OnDestroyed() MOJO_OVERRIDE { |
| 75 base::MessageLoop::current()->Quit(); | 76 base::MessageLoop::current()->Quit(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 virtual void OnEvent(const Event& event) MOJO_OVERRIDE { | 79 virtual void OnEvent(const Event& event) MOJO_OVERRIDE { |
| 79 if (!event.location().is_null()) { | 80 if (!event.location().is_null()) { |
| 80 viewport_->AckEvent(event); | 81 viewport_->AckEvent(event); |
| 81 } | 82 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 MojoHandle shell_handle) { | 98 MojoHandle shell_handle) { |
| 98 base::MessageLoop loop; | 99 base::MessageLoop loop; |
| 99 mojo::GLES2Initializer gles2; | 100 mojo::GLES2Initializer gles2; |
| 100 | 101 |
| 101 mojo::examples::SampleApp app( | 102 mojo::examples::SampleApp app( |
| 102 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); | 103 mojo::MakeScopedHandle(mojo::MessagePipeHandle(shell_handle)).Pass()); |
| 103 loop.Run(); | 104 loop.Run(); |
| 104 | 105 |
| 105 return MOJO_RESULT_OK; | 106 return MOJO_RESULT_OK; |
| 106 } | 107 } |
| OLD | NEW |