OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_TRANSPORT_TEXTURE_SERVICE_H_ | 5 #ifndef CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_SERVICE_H_ |
6 #define CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_SERVICE_H_ | 6 #define CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_SERVICE_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "content/renderer/gpu/gpu_channel_host.h" | 12 #include "content/renderer/gpu/gpu_channel_host.h" |
13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
14 #include "media/base/buffers.h" | 14 #include "media/base/buffers.h" |
15 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
16 | 16 |
17 class RendererGLContext; | 17 class RendererGLContext; |
18 class TransportTextureHost; | 18 class TransportTextureHost; |
19 | 19 |
20 // This class implements MessageFilter to dispatch IPC messages to | 20 // This class implements MessageFilter to dispatch IPC messages to |
21 // TransportTextureHost. | 21 // TransportTextureHost. |
22 class TransportTextureService : public IPC::ChannelProxy::MessageFilter, | 22 class TransportTextureService : public IPC::ChannelProxy::MessageFilter, |
23 public IPC::Message::Sender { | 23 public IPC::Message::Sender { |
24 public: | 24 public: |
25 TransportTextureService(); | 25 TransportTextureService(); |
26 virtual ~TransportTextureService(); | 26 virtual ~TransportTextureService(); |
27 | 27 |
28 // IPC::ChannelProxy::MessageFilter implementations. | 28 // IPC::ChannelProxy::MessageFilter implementations. |
29 virtual bool OnMessageReceived(const IPC::Message& message); | 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
30 virtual void OnFilterAdded(IPC::Channel* channel); | 30 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; |
31 virtual void OnFilterRemoved(); | 31 virtual void OnFilterRemoved() OVERRIDE; |
32 virtual void OnChannelClosing(); | 32 virtual void OnChannelClosing() OVERRIDE; |
33 | 33 |
34 // Called on ChildThread to create a TransportTextureHost. | 34 // Called on ChildThread to create a TransportTextureHost. |
35 // | 35 // |
36 // A routing ID for the GLES2 context needs to be provided. This is | 36 // A routing ID for the GLES2 context needs to be provided. This is |
37 // important because the resources used needs to be shared with the GLES2 | 37 // important because the resources used needs to be shared with the GLES2 |
38 // context corresponding to the RenderView. | 38 // context corresponding to the RenderView. |
39 scoped_refptr<TransportTextureHost> CreateTransportTextureHost( | 39 scoped_refptr<TransportTextureHost> CreateTransportTextureHost( |
40 RendererGLContext* context, int context_route_id); | 40 RendererGLContext* context, int context_route_id); |
41 | 41 |
42 // Called by TransportTextureHost to remove a route. | 42 // Called by TransportTextureHost to remove a route. |
43 void RemoveRoute(int32 host_id); | 43 void RemoveRoute(int32 host_id); |
44 | 44 |
45 // IPC::Message::Sender Implementation. | 45 // IPC::Message::Sender Implementation. |
46 virtual bool Send(IPC::Message* msg); | 46 virtual bool Send(IPC::Message* msg) OVERRIDE; |
47 | 47 |
48 private: | 48 private: |
49 typedef std::pair<int32, IPC::Channel::Listener*> PendingRoute; | 49 typedef std::pair<int32, IPC::Channel::Listener*> PendingRoute; |
50 | 50 |
51 // Add a route from |host_id| to |listener|. If channel is not connected yet | 51 // Add a route from |host_id| to |listener|. If channel is not connected yet |
52 // then the information is saved. | 52 // then the information is saved. |
53 void AddRouteInternal(int32 host_id, IPC::Channel::Listener* listener); | 53 void AddRouteInternal(int32 host_id, IPC::Channel::Listener* listener); |
54 | 54 |
55 // Helper method to remove a route. | 55 // Helper method to remove a route. |
56 void RemoveRouteInternal(int32 host_id); | 56 void RemoveRouteInternal(int32 host_id); |
(...skipping 10 matching lines...) Expand all Loading... |
67 // ID for the next TransportTextureHost. | 67 // ID for the next TransportTextureHost. |
68 int32 next_host_id_; | 68 int32 next_host_id_; |
69 | 69 |
70 std::vector<PendingRoute> pending_routes_; | 70 std::vector<PendingRoute> pending_routes_; |
71 std::vector<IPC::Message*> pending_messages_; | 71 std::vector<IPC::Message*> pending_messages_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(TransportTextureService); | 73 DISALLOW_COPY_AND_ASSIGN(TransportTextureService); |
74 }; | 74 }; |
75 | 75 |
76 #endif // CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_SERVICE_H_ | 76 #endif // CONTENT_RENDERER_GPU_TRANSPORT_TEXTURE_SERVICE_H_ |
OLD | NEW |