Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | |
| 6 #define CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "content/common/android/surface_texture_peer.h" | |
| 11 #include "ipc/ipc_channel.h" | |
| 12 #include "ipc/ipc_message.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 class Size; | |
| 16 } | |
| 17 | |
| 18 class GpuChannelHost; | |
| 19 struct GpuStreamTextureMsg_MatrixChanged_Params; | |
| 20 | |
| 21 namespace content { | |
| 22 | |
| 23 // Class for handling all the IPC messages between the GPU process and | |
| 24 // StreamTextureProxy. | |
| 25 class StreamTextureHost : public IPC::Listener { | |
| 26 public: | |
| 27 StreamTextureHost(GpuChannelHost* channel); | |
|
apatrick_chromium
2012/07/12 23:51:31
explicit
qinmin
2012/07/13 00:41:33
Done.
| |
| 28 virtual ~StreamTextureHost(); | |
| 29 | |
| 30 bool Initialize(int stream_id, const gfx::Size& initial_size); | |
| 31 | |
| 32 // Listener class that is listening to the stream texture updates. It is | |
| 33 // implemented by StreamTextureProxyImpl. | |
| 34 class Listener { | |
| 35 public: | |
| 36 virtual void OnFrameAvailable() = 0; | |
| 37 virtual void OnMatrixChanged(const float mtx[16]) = 0; | |
| 38 virtual ~Listener() {} | |
| 39 }; | |
| 40 | |
| 41 void SetListener(Listener* listener) { listener_ = listener; } | |
| 42 | |
| 43 // Request the GPU process to create the surface texture and forward it | |
| 44 // to the renderer process. | |
| 45 void EstablishPeer(SurfaceTexturePeer::SurfaceTextureTarget type, | |
| 46 int32 primary_id, int32 secondary_id); | |
| 47 | |
| 48 // IPC::Channel::Listener implementation: | |
| 49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 50 virtual void OnChannelError() OVERRIDE; | |
| 51 | |
| 52 private: | |
| 53 // Message handlers: | |
| 54 void OnFrameAvailable(); | |
| 55 void OnMatrixChanged(const GpuStreamTextureMsg_MatrixChanged_Params& param); | |
| 56 | |
| 57 int route_id_; | |
| 58 int stream_id_; | |
| 59 Listener* listener_; | |
| 60 scoped_refptr<GpuChannelHost> channel_; | |
| 61 base::WeakPtrFactory<StreamTextureHost> weak_ptr_factory_; | |
| 62 | |
| 63 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureHost); | |
| 64 }; | |
| 65 | |
| 66 } // namespace content | |
| 67 | |
| 68 #endif // CONTENT_RENDERER_GPU_STREAM_TEXTURE_HOST_ANDROID_H_ | |
| OLD | NEW |