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 "content/common/gpu/stream_texture_android.h" | 5 #include "content/common/gpu/stream_texture_android.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/common/android/surface_texture_peer.h" | 8 #include "content/common/android/surface_texture_peer.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 StreamTexture::~StreamTexture() { | 81 StreamTexture::~StreamTexture() { |
82 if (owner_stub_) { | 82 if (owner_stub_) { |
83 owner_stub_->RemoveDestructionObserver(this); | 83 owner_stub_->RemoveDestructionObserver(this); |
84 owner_stub_->channel()->RemoveRoute(route_id_); | 84 owner_stub_->channel()->RemoveRoute(route_id_); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 void StreamTexture::OnWillDestroyStub() { | 88 void StreamTexture::OnWillDestroyStub() { |
89 owner_stub_->RemoveDestructionObserver(this); | 89 owner_stub_->RemoveDestructionObserver(this); |
90 owner_stub_->channel()->RemoveRoute(route_id_); | 90 owner_stub_->channel()->RemoveRoute(route_id_); |
91 owner_stub_ = NULL; | 91 owner_stub_ = nullptr; |
92 | 92 |
93 // If the owner goes away, there is no need to keep the SurfaceTexture around. | 93 // If the owner goes away, there is no need to keep the SurfaceTexture around. |
94 // The GL texture will keep working regardless with the currently bound frame. | 94 // The GL texture will keep working regardless with the currently bound frame. |
95 surface_texture_ = NULL; | 95 surface_texture_ = nullptr; |
96 } | 96 } |
97 | 97 |
98 void StreamTexture::Destroy(bool have_context) { | 98 void StreamTexture::Destroy(bool have_context) { |
99 NOTREACHED(); | 99 NOTREACHED(); |
100 } | 100 } |
101 | 101 |
102 void StreamTexture::WillUseTexImage() { | 102 void StreamTexture::WillUseTexImage() { |
103 if (!owner_stub_ || !surface_texture_.get()) | 103 if (!owner_stub_ || !surface_texture_.get()) |
104 return; | 104 return; |
105 | 105 |
106 if (has_pending_frame_) { | 106 if (has_pending_frame_) { |
107 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; | 107 scoped_ptr<ui::ScopedMakeCurrent> scoped_make_current; |
108 bool needs_make_current = | 108 bool needs_make_current = |
109 !owner_stub_->decoder()->GetGLContext()->IsCurrent(NULL); | 109 !owner_stub_->decoder()->GetGLContext()->IsCurrent(nullptr); |
110 // On Android we should not have to perform a real context switch here when | 110 // On Android we should not have to perform a real context switch here when |
111 // using virtual contexts. | 111 // using virtual contexts. |
112 DCHECK(!needs_make_current || !owner_stub_->decoder() | 112 DCHECK(!needs_make_current || !owner_stub_->decoder() |
113 ->GetContextGroup() | 113 ->GetContextGroup() |
114 ->feature_info() | 114 ->feature_info() |
115 ->workarounds() | 115 ->workarounds() |
116 .use_virtualized_gl_contexts); | 116 .use_virtualized_gl_contexts); |
117 if (needs_make_current) { | 117 if (needs_make_current) { |
118 scoped_make_current.reset(new ui::ScopedMakeCurrent( | 118 scoped_make_current.reset(new ui::ScopedMakeCurrent( |
119 owner_stub_->decoder()->GetGLContext(), owner_stub_->surface())); | 119 owner_stub_->decoder()->GetGLContext(), owner_stub_->surface())); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 bool StreamTexture::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 209 bool StreamTexture::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
210 int z_order, | 210 int z_order, |
211 gfx::OverlayTransform transform, | 211 gfx::OverlayTransform transform, |
212 const gfx::Rect& bounds_rect, | 212 const gfx::Rect& bounds_rect, |
213 const gfx::RectF& crop_rect) { | 213 const gfx::RectF& crop_rect) { |
214 NOTREACHED(); | 214 NOTREACHED(); |
215 return false; | 215 return false; |
216 } | 216 } |
217 | 217 |
218 } // namespace content | 218 } // namespace content |
OLD | NEW |