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 "mojo/examples/sample_app/native_viewport_client_impl.h" | 5 #include "mojo/examples/sample_app/native_viewport_client_impl.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "mojo/public/bindings/gles2_client/gles2_client_impl.h" | |
10 | |
11 namespace mojo { | 9 namespace mojo { |
12 namespace examples { | 10 namespace examples { |
13 | 11 |
14 NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe) | 12 NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe) |
15 : service_(pipe.Pass()) { | 13 : service_(pipe.Pass()) { |
16 service_.SetPeer(this); | 14 service_.SetPeer(this); |
17 } | 15 } |
18 | 16 |
19 NativeViewportClientImpl::~NativeViewportClientImpl() { | 17 NativeViewportClientImpl::~NativeViewportClientImpl() { |
20 service_->Close(); | 18 service_->Close(); |
21 } | 19 } |
22 | 20 |
23 void NativeViewportClientImpl::Open() { | 21 void NativeViewportClientImpl::Open() { |
24 service_->Open(); | 22 service_->Open(); |
25 | 23 |
26 ScopedMessagePipeHandle gles2; | 24 ScopedMessagePipeHandle gles2; |
27 ScopedMessagePipeHandle gles2_client; | 25 ScopedMessagePipeHandle gles2_client; |
28 CreateMessagePipe(&gles2, &gles2_client); | 26 CreateMessagePipe(&gles2, &gles2_client); |
29 | 27 |
30 gles2_client_.reset(new GLES2ClientImpl(&gles2_delegate_, gles2.Pass())); | 28 gles2_client_.reset(new GLES2ClientImpl(gles2.Pass())); |
31 service_->CreateGLES2Context(gles2_client.release()); | 29 service_->CreateGLES2Context(gles2_client.release()); |
32 } | 30 } |
33 | 31 |
34 void NativeViewportClientImpl::DidOpen() { | 32 void NativeViewportClientImpl::DidOpen() { |
35 } | 33 } |
36 | 34 |
37 } // namespace examples | 35 } // namespace examples |
38 } // namespace mojo | 36 } // namespace mojo |
OLD | NEW |