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 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ | 5 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ |
6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ | 6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
11 #include "ipc/ipc_listener.h" | 11 #include "ipc/ipc_listener.h" |
12 #include "ui/gl/android/surface_texture.h" | 12 #include "ui/gl/android/surface_texture.h" |
13 #include "ui/gl/gl_image.h" | 13 #include "ui/gl/gl_image.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Size; | 16 class Size; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class StreamTexture : public gfx::GLImage, | 21 class StreamTexture : public gfx::GLImage, |
22 public IPC::Listener, | 22 public IPC::Listener, |
23 public GpuCommandBufferStub::DestructionObserver { | 23 public GpuCommandBufferStub::DestructionObserver { |
24 public: | 24 public: |
25 static bool Create(GpuCommandBufferStub* owner_stub, | 25 static bool CreateStreamTexture(GpuCommandBufferStub* owner_stub, |
26 uint32 client_texture_id, | 26 uint32 client_texture_id, |
27 int stream_id); | 27 int stream_id); |
| 28 static bool CreateStreamTextureImage(GpuCommandBufferStub* owner_stub, |
| 29 int32 image_id, |
| 30 int32 stream_id); |
28 | 31 |
29 private: | 32 private: |
30 StreamTexture(GpuCommandBufferStub* owner_stub, | 33 StreamTexture(GpuCommandBufferStub* owner_stub, |
31 int32 route_id, | 34 int32 route_id, |
32 uint32 texture_id); | 35 int32 texture_id); |
33 ~StreamTexture() override; | 36 ~StreamTexture() override; |
34 | 37 |
35 // gfx::GLImage implementation: | 38 // gfx::GLImage implementation: |
36 void Destroy(bool have_context) override; | 39 void Destroy(bool have_context) override; |
37 gfx::Size GetSize() override; | 40 gfx::Size GetSize() override; |
38 unsigned GetInternalFormat() override; | 41 unsigned GetInternalFormat() override; |
39 bool BindTexImage(unsigned target) override; | 42 bool BindTexImage(unsigned target) override; |
40 void ReleaseTexImage(unsigned target) override; | 43 void ReleaseTexImage(unsigned target) override; |
41 bool CopyTexSubImage(unsigned target, | 44 bool CopyTexSubImage(unsigned target, |
42 const gfx::Point& offset, | 45 const gfx::Point& offset, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 78 |
76 // Whether we ever bound a valid frame. | 79 // Whether we ever bound a valid frame. |
77 bool has_valid_frame_; | 80 bool has_valid_frame_; |
78 | 81 |
79 // Whether a new frame is available that we should update to. | 82 // Whether a new frame is available that we should update to. |
80 bool has_pending_frame_; | 83 bool has_pending_frame_; |
81 | 84 |
82 GpuCommandBufferStub* owner_stub_; | 85 GpuCommandBufferStub* owner_stub_; |
83 int32 route_id_; | 86 int32 route_id_; |
84 bool has_listener_; | 87 bool has_listener_; |
| 88 GLint texture_id_; |
85 | 89 |
86 base::WeakPtrFactory<StreamTexture> weak_factory_; | 90 base::WeakPtrFactory<StreamTexture> weak_factory_; |
87 DISALLOW_COPY_AND_ASSIGN(StreamTexture); | 91 DISALLOW_COPY_AND_ASSIGN(StreamTexture); |
88 }; | 92 }; |
89 | 93 |
90 } // namespace content | 94 } // namespace content |
91 | 95 |
92 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ | 96 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ |
OLD | NEW |