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

Side by Side Diff: gpu/command_buffer/service/stream_texture_manager_in_process_android.cc

Issue 191933002: This is initial API support required for enabling SurfaceTexture backed zero-copy for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build issues Created 6 years, 9 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 unified diff | Download patch
OLDNEW
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 "gpu/command_buffer/service/stream_texture_manager_in_process_android.h " 5 #include "gpu/command_buffer/service/stream_texture_manager_in_process_android.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "gpu/command_buffer/service/texture_manager.h" 9 #include "gpu/command_buffer/service/texture_manager.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 CalledOnValidThread(); 76 CalledOnValidThread();
77 77
78 gles2::TextureRef* texture = texture_manager->GetTexture(client_texture_id); 78 gles2::TextureRef* texture = texture_manager->GetTexture(client_texture_id);
79 79
80 if (!texture || (texture->texture()->target() && 80 if (!texture || (texture->texture()->target() &&
81 texture->texture()->target() != GL_TEXTURE_EXTERNAL_OES)) { 81 texture->texture()->target() != GL_TEXTURE_EXTERNAL_OES)) {
82 return 0; 82 return 0;
83 } 83 }
84 84
85 scoped_refptr<gfx::SurfaceTexture> surface_texture( 85 scoped_refptr<gfx::SurfaceTexture> surface_texture(
86 new gfx::SurfaceTexture(texture->service_id())); 86 gfx::SurfaceTexture::Create(texture->service_id()));
87 87
88 uint32 stream_id = next_id_++; 88 uint32 stream_id = next_id_++;
89 base::Closure release_callback = 89 base::Closure release_callback =
90 base::Bind(&StreamTextureManagerInProcess::OnReleaseStreamTexture, 90 base::Bind(&StreamTextureManagerInProcess::OnReleaseStreamTexture,
91 weak_factory_.GetWeakPtr(), stream_id); 91 weak_factory_.GetWeakPtr(), stream_id);
92 scoped_refptr<gfx::GLImage> gl_image(new GLImageImpl(surface_texture, 92 scoped_refptr<gfx::GLImage> gl_image(new GLImageImpl(surface_texture,
93 release_callback)); 93 release_callback));
94 94
95 gfx::Size size = gl_image->GetSize(); 95 gfx::Size size = gl_image->GetSize();
96 texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES); 96 texture_manager->SetTarget(texture, GL_TEXTURE_EXTERNAL_OES);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) { 129 StreamTextureManagerInProcess::GetSurfaceTexture(uint32 stream_id) {
130 base::AutoLock lock(map_lock_); 130 base::AutoLock lock(map_lock_);
131 TextureMap::const_iterator it = textures_.find(stream_id); 131 TextureMap::const_iterator it = textures_.find(stream_id);
132 if (it != textures_.end()) 132 if (it != textures_.end())
133 return it->second; 133 return it->second;
134 134
135 return NULL; 135 return NULL;
136 } 136 }
137 137
138 } // namespace gpu 138 } // namespace gpu
OLDNEW
« no previous file with comments | « content/common/gpu/stream_texture_android.cc ('k') | gpu/command_buffer/tests/gl_unittests_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698