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