Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: content/common/gpu/surface_texture_bridge_android.cc

Issue 177953004: Enable SurfaceTexture based zero-copy texture uploading on Android platform Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698