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

Side by Side Diff: content/renderer/media/android/stream_texture_factory_synchronous_impl.cc

Issue 1385883002: Leave CreateStreamTexture route id out of the GL interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing TOT! Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/media/android/stream_texture_factory_synchronous_impl .h" 5 #include "content/renderer/media/android/stream_texture_factory_synchronous_impl .h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 if (!context_provider_.get()) 173 if (!context_provider_.get())
174 return NULL; 174 return NULL;
175 175
176 if (observer_ && !had_proxy) 176 if (observer_ && !had_proxy)
177 context_provider_->AddObserver(observer_); 177 context_provider_->AddObserver(observer_);
178 return new StreamTextureProxyImpl(context_provider_.get()); 178 return new StreamTextureProxyImpl(context_provider_.get());
179 } 179 }
180 180
181 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, 181 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id,
182 int player_id) { 182 int player_id,
183 int frame_id) {
183 DCHECK(context_provider_.get()); 184 DCHECK(context_provider_.get());
184 scoped_refptr<gfx::SurfaceTexture> surface_texture = 185 scoped_refptr<gfx::SurfaceTexture> surface_texture =
185 context_provider_->GetSurfaceTexture(stream_id); 186 context_provider_->GetSurfaceTexture(stream_id);
186 if (surface_texture.get()) { 187 if (surface_texture.get()) {
187 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( 188 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer(
188 base::GetCurrentProcessHandle(), 189 base::GetCurrentProcessHandle(),
189 surface_texture, 190 surface_texture,
190 frame_id_, 191 frame_id_,
191 player_id); 192 player_id);
192 } 193 }
193 } 194 }
194 195
195 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( 196 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture(
196 unsigned texture_target, 197 unsigned texture_target,
197 unsigned* texture_id, 198 unsigned* texture_id,
198 gpu::Mailbox* texture_mailbox) { 199 gpu::Mailbox* texture_mailbox) {
199 DCHECK(context_provider_.get()); 200 DCHECK(context_provider_.get());
200 unsigned stream_id = 0; 201 unsigned stream_id = 0;
201 GLES2Interface* gl = context_provider_->ContextGL(); 202 GLES2Interface* gl = context_provider_->ContextGL();
202 gl->GenTextures(1, texture_id); 203 gl->GenTextures(1, texture_id);
203 stream_id = gl->CreateStreamTextureCHROMIUM(*texture_id); 204 gl->ShallowFlushCHROMIUM();
204 205 stream_id = context_provider_->CreateStreamTexture(*texture_id);
205 gl->GenMailboxCHROMIUM(texture_mailbox->name); 206 gl->GenMailboxCHROMIUM(texture_mailbox->name);
206 gl->ProduceTextureDirectCHROMIUM( 207 gl->ProduceTextureDirectCHROMIUM(
207 *texture_id, texture_target, texture_mailbox->name); 208 *texture_id, texture_target, texture_mailbox->name);
208 return stream_id; 209 return stream_id;
209 } 210 }
210 211
211 void StreamTextureFactorySynchronousImpl::SetStreamTextureSize( 212 void StreamTextureFactorySynchronousImpl::SetStreamTextureSize(
212 int32 stream_id, 213 int32 stream_id,
213 const gfx::Size& size) {} 214 const gfx::Size& size) {}
214 215
(...skipping 12 matching lines...) Expand all
227 228
228 void StreamTextureFactorySynchronousImpl::RemoveObserver( 229 void StreamTextureFactorySynchronousImpl::RemoveObserver(
229 StreamTextureFactoryContextObserver* obs) { 230 StreamTextureFactoryContextObserver* obs) {
230 DCHECK_EQ(observer_, obs); 231 DCHECK_EQ(observer_, obs);
231 observer_ = NULL; 232 observer_ = NULL;
232 if (context_provider_.get()) 233 if (context_provider_.get())
233 context_provider_->RemoveObserver(obs); 234 context_provider_->RemoveObserver(obs);
234 } 235 }
235 236
236 } // namespace content 237 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698