OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/ipc/service/stream_texture_android.h" | 5 #include "gpu/ipc/service/stream_texture_android.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "gpu/command_buffer/service/context_group.h" | 10 #include "gpu/command_buffer/service/context_group.h" |
11 #include "gpu/command_buffer/service/context_state.h" | 11 #include "gpu/command_buffer/service/context_state.h" |
12 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 12 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
13 #include "gpu/command_buffer/service/texture_manager.h" | 13 #include "gpu/command_buffer/service/texture_manager.h" |
| 14 #include "gpu/ipc/common/android/scoped_surface_request_conduit.h" |
14 #include "gpu/ipc/common/android/surface_texture_peer.h" | 15 #include "gpu/ipc/common/android/surface_texture_peer.h" |
15 #include "gpu/ipc/common/gpu_messages.h" | 16 #include "gpu/ipc/common/gpu_messages.h" |
16 #include "gpu/ipc/service/gpu_channel.h" | 17 #include "gpu/ipc/service/gpu_channel.h" |
17 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
18 #include "ui/gl/gl_context.h" | 19 #include "ui/gl/gl_context.h" |
19 #include "ui/gl/scoped_make_current.h" | 20 #include "ui/gl/scoped_make_current.h" |
20 | 21 |
21 namespace gpu { | 22 namespace gpu { |
22 | 23 |
23 using gles2::ContextGroup; | 24 using gles2::ContextGroup; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 193 } |
193 | 194 |
194 unsigned StreamTexture::GetInternalFormat() { | 195 unsigned StreamTexture::GetInternalFormat() { |
195 return GL_RGBA; | 196 return GL_RGBA; |
196 } | 197 } |
197 | 198 |
198 bool StreamTexture::OnMessageReceived(const IPC::Message& message) { | 199 bool StreamTexture::OnMessageReceived(const IPC::Message& message) { |
199 bool handled = true; | 200 bool handled = true; |
200 IPC_BEGIN_MESSAGE_MAP(StreamTexture, message) | 201 IPC_BEGIN_MESSAGE_MAP(StreamTexture, message) |
201 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_StartListening, OnStartListening) | 202 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_StartListening, OnStartListening) |
| 203 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_ForwardForSurfaceRequest, |
| 204 OnForwardForSurfaceRequest) |
202 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_EstablishPeer, OnEstablishPeer) | 205 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_EstablishPeer, OnEstablishPeer) |
203 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_SetSize, OnSetSize) | 206 IPC_MESSAGE_HANDLER(GpuStreamTextureMsg_SetSize, OnSetSize) |
204 IPC_MESSAGE_UNHANDLED(handled = false) | 207 IPC_MESSAGE_UNHANDLED(handled = false) |
205 IPC_END_MESSAGE_MAP() | 208 IPC_END_MESSAGE_MAP() |
206 | 209 |
207 DCHECK(handled); | 210 DCHECK(handled); |
208 return handled; | 211 return handled; |
209 } | 212 } |
210 | 213 |
211 void StreamTexture::OnStartListening() { | 214 void StreamTexture::OnStartListening() { |
212 DCHECK(!has_listener_); | 215 DCHECK(!has_listener_); |
213 has_listener_ = true; | 216 has_listener_ = true; |
214 } | 217 } |
215 | 218 |
216 void StreamTexture::OnEstablishPeer(int32_t primary_id, int32_t secondary_id) { | 219 void StreamTexture::OnEstablishPeer(int32_t primary_id, int32_t secondary_id) { |
217 if (!owner_stub_) | 220 if (!owner_stub_) |
218 return; | 221 return; |
219 | 222 |
220 base::ProcessHandle process = owner_stub_->channel()->GetClientPID(); | 223 base::ProcessHandle process = owner_stub_->channel()->GetClientPID(); |
221 | 224 |
222 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( | 225 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( |
223 process, surface_texture_, primary_id, secondary_id); | 226 process, surface_texture_, primary_id, secondary_id); |
224 } | 227 } |
225 | 228 |
| 229 void StreamTexture::OnForwardForSurfaceRequest( |
| 230 const base::UnguessableToken& request_token) { |
| 231 if (!owner_stub_) |
| 232 return; |
| 233 |
| 234 ScopedSurfaceRequestConduit::GetInstance() |
| 235 ->ForwardSurfaceTextureForSurfaceRequest(request_token, |
| 236 surface_texture_.get()); |
| 237 } |
| 238 |
226 bool StreamTexture::BindTexImage(unsigned target) { | 239 bool StreamTexture::BindTexImage(unsigned target) { |
227 NOTREACHED(); | 240 NOTREACHED(); |
228 return false; | 241 return false; |
229 } | 242 } |
230 | 243 |
231 void StreamTexture::ReleaseTexImage(unsigned target) { | 244 void StreamTexture::ReleaseTexImage(unsigned target) { |
232 NOTREACHED(); | 245 NOTREACHED(); |
233 } | 246 } |
234 | 247 |
235 bool StreamTexture::CopyTexSubImage(unsigned target, | 248 bool StreamTexture::CopyTexSubImage(unsigned target, |
(...skipping 11 matching lines...) Expand all Loading... |
247 return false; | 260 return false; |
248 } | 261 } |
249 | 262 |
250 void StreamTexture::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 263 void StreamTexture::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
251 uint64_t process_tracing_id, | 264 uint64_t process_tracing_id, |
252 const std::string& dump_name) { | 265 const std::string& dump_name) { |
253 // TODO(ericrk): Add OnMemoryDump for GLImages. crbug.com/514914 | 266 // TODO(ericrk): Add OnMemoryDump for GLImages. crbug.com/514914 |
254 } | 267 } |
255 | 268 |
256 } // namespace gpu | 269 } // namespace gpu |
OLD | NEW |