Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / common / gpu / image_transport_surface_win.cc
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/gpu/image_transport_surface.h"
6
7 #include "base/bind.h"
8 #include "base/command_line.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/win/windows_version.h"
13 #include "content/common/gpu/gpu_messages.h"
14 #include "content/public/common/content_switches.h"
15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gl/gl_bindings.h"
17 #include "ui/gl/gl_context.h"
18 #include "ui/gl/gl_implementation.h"
19 #include "ui/gl/gl_surface_egl.h"
20
21 namespace content {
22
23 // static
24 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(
25     GpuChannelManager* manager,
26     GpuCommandBufferStub* stub,
27     const gfx::GLSurfaceHandle& handle) {
28   DCHECK(handle.handle);
29   DCHECK_EQ(handle.transport_type, gfx::NATIVE_DIRECT);
30   scoped_refptr<gfx::GLSurface> surface =
31       gfx::GLSurface::CreateViewGLSurface(handle.handle);
32   if (!surface)
33     return surface;
34   return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface(
35       manager, stub, surface.get()));
36 }
37
38 }  // namespace content