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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/common/gpu/gpu_command_buffer_stub.h" | 12 #include "content/common/gpu/gpu_command_buffer_stub.h" |
13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "ui/gl/android/surface_texture.h" | 14 #include "ui/gl/android/surface_texture.h" |
15 #include "ui/gl/gl_image.h" | 15 #include "ui/gl/gl_image.h" |
16 | 16 |
| 17 namespace ui { |
| 18 class ScopedMakeCurrent; |
| 19 } |
| 20 |
17 namespace gfx { | 21 namespace gfx { |
18 class Size; | 22 class Size; |
19 } | 23 } |
20 | 24 |
21 namespace content { | 25 namespace content { |
22 | 26 |
23 class StreamTexture : public gl::GLImage, | 27 class StreamTexture : public gl::GLImage, |
24 public IPC::Listener, | 28 public IPC::Listener, |
25 public GpuCommandBufferStub::DestructionObserver { | 29 public GpuCommandBufferStub::DestructionObserver { |
26 public: | 30 public: |
(...skipping 22 matching lines...) Expand all Loading... |
49 gfx::OverlayTransform transform, | 53 gfx::OverlayTransform transform, |
50 const gfx::Rect& bounds_rect, | 54 const gfx::Rect& bounds_rect, |
51 const gfx::RectF& crop_rect) override; | 55 const gfx::RectF& crop_rect) override; |
52 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, | 56 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
53 uint64_t process_tracing_id, | 57 uint64_t process_tracing_id, |
54 const std::string& dump_name) override; | 58 const std::string& dump_name) override; |
55 | 59 |
56 // GpuCommandBufferStub::DestructionObserver implementation. | 60 // GpuCommandBufferStub::DestructionObserver implementation. |
57 void OnWillDestroyStub() override; | 61 void OnWillDestroyStub() override; |
58 | 62 |
| 63 scoped_ptr<ui::ScopedMakeCurrent> MakeStubCurrent(); |
| 64 |
| 65 void UpdateTexImage(); |
| 66 |
59 // Called when a new frame is available for the SurfaceTexture. | 67 // Called when a new frame is available for the SurfaceTexture. |
60 void OnFrameAvailable(); | 68 void OnFrameAvailable(); |
61 | 69 |
62 // IPC::Listener implementation: | 70 // IPC::Listener implementation: |
63 bool OnMessageReceived(const IPC::Message& message) override; | 71 bool OnMessageReceived(const IPC::Message& message) override; |
64 | 72 |
65 // IPC message handlers: | 73 // IPC message handlers: |
66 void OnStartListening(); | 74 void OnStartListening(); |
67 void OnEstablishPeer(int32_t primary_id, int32_t secondary_id); | 75 void OnEstablishPeer(int32_t primary_id, int32_t secondary_id); |
68 void OnSetSize(const gfx::Size& size) { size_ = size; } | 76 void OnSetSize(const gfx::Size& size) { size_ = size; } |
(...skipping 10 matching lines...) Expand all Loading... |
79 bool has_valid_frame_; | 87 bool has_valid_frame_; |
80 | 88 |
81 // Whether a new frame is available that we should update to. | 89 // Whether a new frame is available that we should update to. |
82 bool has_pending_frame_; | 90 bool has_pending_frame_; |
83 | 91 |
84 GpuCommandBufferStub* owner_stub_; | 92 GpuCommandBufferStub* owner_stub_; |
85 int32_t route_id_; | 93 int32_t route_id_; |
86 bool has_listener_; | 94 bool has_listener_; |
87 uint32_t texture_id_; | 95 uint32_t texture_id_; |
88 | 96 |
| 97 unsigned framebuffer_; |
| 98 unsigned vertex_shader_; |
| 99 unsigned fragment_shader_; |
| 100 unsigned program_; |
| 101 unsigned vertex_buffer_; |
| 102 int u_xform_location_; |
| 103 |
89 base::WeakPtrFactory<StreamTexture> weak_factory_; | 104 base::WeakPtrFactory<StreamTexture> weak_factory_; |
90 DISALLOW_COPY_AND_ASSIGN(StreamTexture); | 105 DISALLOW_COPY_AND_ASSIGN(StreamTexture); |
91 }; | 106 }; |
92 | 107 |
93 } // namespace content | 108 } // namespace content |
94 | 109 |
95 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ | 110 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ |
OLD | NEW |