OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ |
6 #define CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | 6 #define CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_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 "gpu/ipc/common/android/surface_texture_peer.h" | 12 #include "gpu/ipc/common/android/surface_texture_peer.h" |
13 #include "ipc/ipc_listener.h" | 13 #include "ipc/ipc_listener.h" |
14 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
15 | 15 |
| 16 namespace base { |
| 17 class UnguessableToken; |
| 18 } |
| 19 |
16 namespace gfx { | 20 namespace gfx { |
17 class Size; | 21 class Size; |
18 } | 22 } |
19 | 23 |
20 namespace gpu { | 24 namespace gpu { |
21 class GpuChannelHost; | 25 class GpuChannelHost; |
22 } | 26 } |
23 | 27 |
24 struct GpuStreamTextureMsg_MatrixChanged_Params; | 28 struct GpuStreamTextureMsg_MatrixChanged_Params; |
25 | 29 |
26 namespace content { | 30 namespace content { |
27 | 31 |
28 // Class for handling all the IPC messages between the GPU process and | 32 // Class for handling all the IPC messages between the GPU process and |
29 // StreamTextureProxy. | 33 // StreamTextureProxy. |
30 class StreamTextureHost : public IPC::Listener { | 34 class StreamTextureHost : public IPC::Listener { |
31 public: | 35 public: |
32 explicit StreamTextureHost(scoped_refptr<gpu::GpuChannelHost> channel); | 36 explicit StreamTextureHost(scoped_refptr<gpu::GpuChannelHost> channel, |
| 37 int32_t route_id); |
33 ~StreamTextureHost() override; | 38 ~StreamTextureHost() override; |
34 | 39 |
35 // Listener class that is listening to the stream texture updates. It is | 40 // Listener class that is listening to the stream texture updates. It is |
36 // implemented by StreamTextureProxyImpl. | 41 // implemented by StreamTextureProxyImpl. |
37 class Listener { | 42 class Listener { |
38 public: | 43 public: |
39 virtual void OnFrameAvailable() = 0; | 44 virtual void OnFrameAvailable() = 0; |
40 virtual ~Listener() {} | 45 virtual ~Listener() {} |
41 }; | 46 }; |
42 | 47 |
43 bool BindToCurrentThread(int32_t stream_id, Listener* listener); | 48 bool BindToCurrentThread(Listener* listener); |
44 | 49 |
45 // IPC::Channel::Listener implementation: | 50 // IPC::Channel::Listener implementation: |
46 bool OnMessageReceived(const IPC::Message& message) override; | 51 bool OnMessageReceived(const IPC::Message& message) override; |
47 void OnChannelError() override; | 52 void OnChannelError() override; |
48 | 53 |
| 54 void EstablishPeer(int player_id, int frame_id); |
| 55 void SetStreamTextureSize(const gfx::Size& size); |
| 56 void ForwardStreamTextureForSurfaceRequest( |
| 57 const base::UnguessableToken& request_token); |
| 58 |
49 private: | 59 private: |
50 // Message handlers: | 60 // Message handlers: |
51 void OnFrameAvailable(); | 61 void OnFrameAvailable(); |
52 | 62 |
53 int stream_id_; | 63 int32_t route_id_; |
54 Listener* listener_; | 64 Listener* listener_; |
55 scoped_refptr<gpu::GpuChannelHost> channel_; | 65 scoped_refptr<gpu::GpuChannelHost> channel_; |
56 base::WeakPtrFactory<StreamTextureHost> weak_ptr_factory_; | 66 base::WeakPtrFactory<StreamTextureHost> weak_ptr_factory_; |
57 | 67 |
58 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureHost); | 68 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureHost); |
59 }; | 69 }; |
60 | 70 |
61 } // namespace content | 71 } // namespace content |
62 | 72 |
63 #endif // CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | 73 #endif // CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ |
OLD | NEW |