OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/gpu/media/avda_shared_state.h" | 5 #include "content/common/gpu/media/avda_shared_state.h" |
6 | 6 |
7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
8 #include "ui/gl/scoped_make_current.h" | 8 #include "ui/gl/scoped_make_current.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 AVDASharedState::AVDASharedState() | 12 AVDASharedState::AVDASharedState() |
13 : surface_texture_service_id_(0), | 13 : surface_texture_service_id_(0), |
14 frame_available_event_(false, false), | 14 frame_available_event_(false, false), |
15 surface_texture_is_attached_(false) {} | 15 surface_texture_is_attached_(false) {} |
16 | 16 |
17 AVDASharedState::~AVDASharedState() {} | 17 AVDASharedState::~AVDASharedState() {} |
18 | 18 |
19 void AVDASharedState::SignalFrameAvailable() { | 19 void AVDASharedState::SignalFrameAvailable() { |
20 frame_available_event_.Signal(); | 20 frame_available_event_.Signal(); |
21 } | 21 } |
22 | 22 |
23 void AVDASharedState::WaitForFrameAvailable() { | 23 void AVDASharedState::WaitForFrameAvailable() { |
24 frame_available_event_.Wait(); | 24 frame_available_event_.Wait(); |
25 } | 25 } |
26 | 26 |
27 void AVDASharedState::did_attach_surface_texture() { | 27 void AVDASharedState::DidAttachSurfaceTexture() { |
28 context_ = gfx::GLContext::GetCurrent(); | 28 context_ = gfx::GLContext::GetCurrent(); |
29 surface_ = gfx::GLSurface::GetCurrent(); | 29 surface_ = gfx::GLSurface::GetCurrent(); |
30 DCHECK(context_); | 30 DCHECK(context_); |
31 DCHECK(surface_); | 31 DCHECK(surface_); |
32 | 32 |
33 surface_texture_is_attached_ = true; | 33 surface_texture_is_attached_ = true; |
34 } | 34 } |
35 | 35 |
| 36 void AVDASharedState::DidDetachSurfaceTexture() { |
| 37 context_ = nullptr; |
| 38 surface_ = nullptr; |
| 39 surface_texture_is_attached_ = false; |
| 40 } |
| 41 |
36 } // namespace content | 42 } // namespace content |
OLD | NEW |