OLD | NEW |
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 "content/renderer/media/android/stream_texture_factory_android.h" | 5 #include "content/renderer/media/android/stream_texture_factory_android.h" |
6 | 6 |
7 #include "content/common/gpu/client/gpu_channel_host.h" | 7 #include "content/common/gpu/client/gpu_channel_host.h" |
8 #include "content/common/gpu/gpu_messages.h" | 8 #include "content/common/gpu/gpu_messages.h" |
9 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 9 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 StreamTextureHost* host = new StreamTextureHost(channel_.get()); | 66 StreamTextureHost* host = new StreamTextureHost(channel_.get()); |
67 return new StreamTextureProxy(host); | 67 return new StreamTextureProxy(host); |
68 } | 68 } |
69 | 69 |
70 void StreamTextureFactory::EstablishPeer(int stream_id, int player_id) { | 70 void StreamTextureFactory::EstablishPeer(int stream_id, int player_id) { |
71 DCHECK(channel_.get()); | 71 DCHECK(channel_.get()); |
72 channel_->Send( | 72 channel_->Send( |
73 new GpuChannelMsg_EstablishStreamTexture(stream_id, view_id_, player_id)); | 73 new GpuChannelMsg_EstablishStreamTexture(stream_id, view_id_, player_id)); |
74 } | 74 } |
75 | 75 |
76 unsigned StreamTextureFactory::CreateStreamTexture(unsigned* texture_id) { | 76 unsigned StreamTextureFactory::CreateStreamTexture( |
| 77 unsigned texture_target, |
| 78 unsigned* texture_id, |
| 79 gpu::Mailbox* texture_mailbox, |
| 80 unsigned* texture_mailbox_sync_point) { |
77 unsigned stream_id = 0; | 81 unsigned stream_id = 0; |
78 if (context_->makeContextCurrent()) { | 82 if (context_->makeContextCurrent()) { |
79 *texture_id = context_->createTexture(); | 83 *texture_id = context_->createTexture(); |
80 stream_id = context_->createStreamTextureCHROMIUM(*texture_id); | 84 stream_id = context_->createStreamTextureCHROMIUM(*texture_id); |
| 85 |
| 86 context_->genMailboxCHROMIUM(texture_mailbox->name); |
| 87 context_->bindTexture(texture_target, *texture_id); |
| 88 context_->produceTextureCHROMIUM(texture_target, texture_mailbox->name); |
| 89 |
81 context_->flush(); | 90 context_->flush(); |
| 91 *texture_mailbox_sync_point = context_->insertSyncPoint(); |
82 } | 92 } |
83 return stream_id; | 93 return stream_id; |
84 } | 94 } |
85 | 95 |
86 void StreamTextureFactory::DestroyStreamTexture(unsigned texture_id) { | 96 void StreamTextureFactory::DestroyStreamTexture(unsigned texture_id) { |
87 if (context_->makeContextCurrent()) { | 97 if (context_->makeContextCurrent()) { |
| 98 // TODO(sievers): Make the destroyStreamTexture implicit when the last |
| 99 // texture referencing it is lost. |
88 context_->destroyStreamTextureCHROMIUM(texture_id); | 100 context_->destroyStreamTextureCHROMIUM(texture_id); |
89 context_->deleteTexture(texture_id); | 101 context_->deleteTexture(texture_id); |
90 context_->flush(); | 102 context_->flush(); |
91 } | 103 } |
92 } | 104 } |
93 | 105 |
94 } // namespace content | 106 } // namespace content |
OLD | NEW |