| 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 gfx { | 16 namespace gfx { |
| 17 class Size; | 17 class Size; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace gpu { |
| 21 class GpuChannelHost; |
| 22 } |
| 23 |
| 20 struct GpuStreamTextureMsg_MatrixChanged_Params; | 24 struct GpuStreamTextureMsg_MatrixChanged_Params; |
| 21 | 25 |
| 22 namespace content { | 26 namespace content { |
| 23 class GpuChannelHost; | |
| 24 | 27 |
| 25 // Class for handling all the IPC messages between the GPU process and | 28 // Class for handling all the IPC messages between the GPU process and |
| 26 // StreamTextureProxy. | 29 // StreamTextureProxy. |
| 27 class StreamTextureHost : public IPC::Listener { | 30 class StreamTextureHost : public IPC::Listener { |
| 28 public: | 31 public: |
| 29 explicit StreamTextureHost(GpuChannelHost* channel); | 32 explicit StreamTextureHost(gpu::GpuChannelHost* channel); |
| 30 ~StreamTextureHost() override; | 33 ~StreamTextureHost() override; |
| 31 | 34 |
| 32 // Listener class that is listening to the stream texture updates. It is | 35 // Listener class that is listening to the stream texture updates. It is |
| 33 // implemented by StreamTextureProxyImpl. | 36 // implemented by StreamTextureProxyImpl. |
| 34 class Listener { | 37 class Listener { |
| 35 public: | 38 public: |
| 36 virtual void OnFrameAvailable() = 0; | 39 virtual void OnFrameAvailable() = 0; |
| 37 virtual ~Listener() {} | 40 virtual ~Listener() {} |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 bool BindToCurrentThread(int32_t stream_id, Listener* listener); | 43 bool BindToCurrentThread(int32_t stream_id, Listener* listener); |
| 41 | 44 |
| 42 // IPC::Channel::Listener implementation: | 45 // IPC::Channel::Listener implementation: |
| 43 bool OnMessageReceived(const IPC::Message& message) override; | 46 bool OnMessageReceived(const IPC::Message& message) override; |
| 44 void OnChannelError() override; | 47 void OnChannelError() override; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 // Message handlers: | 50 // Message handlers: |
| 48 void OnFrameAvailable(); | 51 void OnFrameAvailable(); |
| 49 | 52 |
| 50 int stream_id_; | 53 int stream_id_; |
| 51 Listener* listener_; | 54 Listener* listener_; |
| 52 scoped_refptr<GpuChannelHost> channel_; | 55 scoped_refptr<gpu::GpuChannelHost> channel_; |
| 53 base::WeakPtrFactory<StreamTextureHost> weak_ptr_factory_; | 56 base::WeakPtrFactory<StreamTextureHost> weak_ptr_factory_; |
| 54 | 57 |
| 55 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureHost); | 58 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureHost); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace content | 61 } // namespace content |
| 59 | 62 |
| 60 #endif // CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | 63 #endif // CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ |
| OLD | NEW |