Chromium Code Reviews| Index: content/common/gpu/surface_texture_bridge_android.cc |
| diff --git a/content/common/gpu/surface_texture_bridge_android.cc b/content/common/gpu/surface_texture_bridge_android.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..29ce3a43b3d7eb2a99fc0d191b1603a244e7089f |
| --- /dev/null |
| +++ b/content/common/gpu/surface_texture_bridge_android.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2014 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 "content/common/gpu/surface_texture_bridge_android.h" |
| + |
| +#include "base/bind.h" |
| +#include "content/browser/android/child_process_launcher_android.h" |
| +#include "content/common/android/surface_texture_peer.h" |
| +#include "content/common/gpu/gpu_channel.h" |
| +#include "content/common/gpu/gpu_messages.h" |
| +#include "gpu/command_buffer/service/context_group.h" |
| +#include "gpu/command_buffer/service/context_state.h" |
| +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| +#include "gpu/command_buffer/service/texture_manager.h" |
| +#include "ui/gfx/size.h" |
| +#include "ui/gl/scoped_make_current.h" |
| + |
| +namespace content { |
| + |
| +using gpu::gles2::GLES2Decoder; |
|
Hongbo Min
2014/03/18 06:10:03
You may want to remove these 3 unused 'using' stmt
|
| +using gpu::gles2::TextureManager; |
| +using gpu::gles2::TextureRef; |
| + |
| +// static |
| +gfx::SurfaceTexture* SurfaceTextureBridge::CreateSurfaceTexture( |
| + GpuCommandBufferStub* owner_stub, |
| + uint32* gpu_texture_id) { |
| + unsigned int texture_id = 0; |
| + glGenTextures(1, &texture_id); |
| + *gpu_texture_id = texture_id; |
| + return new gfx::SurfaceTexture(texture_id); |
| +} |
| + |
| +// static |
| +bool SurfaceTextureBridge::SetupSurfaceTexturePeer( |
| + GpuCommandBufferStub* owner_stub, |
| + void* gpu_memory_buffer, |
| + gfx::SurfaceTexture* surface_texture) { |
| + if (!owner_stub) |
| + return false; |
| + |
| + base::ProcessHandle process = owner_stub->channel()->renderer_pid(); |
| + scoped_refptr<gfx::SurfaceTexture> scoped_surface_texture(surface_texture); |
| + SetupSurfaceTextureToRenderer( |
| + process, gpu_memory_buffer, scoped_surface_texture); |
| + return true; |
| +} |
| + |
| +} // namespace content |