OLD | NEW |
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 "ui/gl/gl_image_surface_texture.h" | 5 #include "ui/gl/gl_image_surface_texture.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "ui/gl/android/surface_texture.h" | 8 #include "ui/gl/android/surface_texture.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
11 | 11 |
12 GLImageSurfaceTexture::GLImageSurfaceTexture(const gfx::Size& size) | 12 GLImageSurfaceTexture::GLImageSurfaceTexture(const gfx::Size& size) |
13 : size_(size), texture_id_(0) { | 13 : size_(size), texture_id_(0) { |
14 } | 14 } |
15 | 15 |
16 GLImageSurfaceTexture::~GLImageSurfaceTexture() { | 16 GLImageSurfaceTexture::~GLImageSurfaceTexture() { |
| 17 DCHECK(thread_checker_.CalledOnValidThread()); |
17 DCHECK(!surface_texture_.get()); | 18 DCHECK(!surface_texture_.get()); |
18 DCHECK_EQ(0, texture_id_); | 19 DCHECK_EQ(0, texture_id_); |
19 } | 20 } |
20 | 21 |
21 bool GLImageSurfaceTexture::Initialize(SurfaceTexture* surface_texture) { | 22 bool GLImageSurfaceTexture::Initialize(SurfaceTexture* surface_texture) { |
| 23 DCHECK(thread_checker_.CalledOnValidThread()); |
22 DCHECK(!surface_texture_.get()); | 24 DCHECK(!surface_texture_.get()); |
23 surface_texture_ = surface_texture; | 25 surface_texture_ = surface_texture; |
24 return true; | 26 return true; |
25 } | 27 } |
26 | 28 |
27 void GLImageSurfaceTexture::Destroy(bool have_context) { | 29 void GLImageSurfaceTexture::Destroy(bool have_context) { |
| 30 DCHECK(thread_checker_.CalledOnValidThread()); |
28 surface_texture_ = NULL; | 31 surface_texture_ = NULL; |
29 texture_id_ = 0; | 32 texture_id_ = 0; |
30 } | 33 } |
31 | 34 |
32 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; } | 35 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; } |
33 | 36 |
34 bool GLImageSurfaceTexture::BindTexImage(unsigned target) { | 37 bool GLImageSurfaceTexture::BindTexImage(unsigned target) { |
35 TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage"); | 38 TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage"); |
| 39 DCHECK(thread_checker_.CalledOnValidThread()); |
36 | 40 |
37 if (target != GL_TEXTURE_EXTERNAL_OES) { | 41 if (target != GL_TEXTURE_EXTERNAL_OES) { |
38 LOG(ERROR) | 42 LOG(ERROR) |
39 << "Surface texture can only be bound to TEXTURE_EXTERNAL_OES target"; | 43 << "Surface texture can only be bound to TEXTURE_EXTERNAL_OES target"; |
40 return false; | 44 return false; |
41 } | 45 } |
42 | 46 |
43 GLint texture_id; | 47 GLint texture_id; |
44 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); | 48 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texture_id); |
45 DCHECK(texture_id); | 49 DCHECK(texture_id); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 82 |
79 bool GLImageSurfaceTexture::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 83 bool GLImageSurfaceTexture::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
80 int z_order, | 84 int z_order, |
81 OverlayTransform transform, | 85 OverlayTransform transform, |
82 const Rect& bounds_rect, | 86 const Rect& bounds_rect, |
83 const RectF& crop_rect) { | 87 const RectF& crop_rect) { |
84 return false; | 88 return false; |
85 } | 89 } |
86 | 90 |
87 } // namespace gfx | 91 } // namespace gfx |
OLD | NEW |