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