summaryrefslogtreecommitdiffstats
path: root/mojo/examples/sample_app/native_viewport_client_impl.cc
blob: c956051a80436953cbad51d7820bd1230a10588f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "mojo/examples/sample_app/native_viewport_client_impl.h"

#include <stdio.h>

namespace mojo {
namespace examples {

NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe)
    : service_(pipe.Pass()) {
  service_.SetPeer(this);
}

NativeViewportClientImpl::~NativeViewportClientImpl() {
  service_->Close();
}

void NativeViewportClientImpl::Open() {
  service_->Open();

  ScopedMessagePipeHandle gles2;
  ScopedMessagePipeHandle gles2_client;
  CreateMessagePipe(&gles2, &gles2_client);

  gles2_client_.reset(new GLES2ClientImpl(gles2.Pass()));
  service_->CreateGLES2Context(gles2_client.Pass());
}

void NativeViewportClientImpl::DidOpen() {
}

}  // namespace examples
}  // namespace mojo