OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_GPU_GPU_CHANNEL_H_ | 5 #ifndef CHROME_GPU_GPU_CHANNEL_H_ |
6 #define CHROME_GPU_GPU_CHANNEL_H_ | 6 #define CHROME_GPU_GPU_CHANNEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 18 matching lines...) Expand all Loading... |
29 public IPC::Message::Sender, | 29 public IPC::Message::Sender, |
30 public base::RefCountedThreadSafe<GpuChannel> { | 30 public base::RefCountedThreadSafe<GpuChannel> { |
31 public: | 31 public: |
32 explicit GpuChannel(int renderer_id); | 32 explicit GpuChannel(int renderer_id); |
33 virtual ~GpuChannel(); | 33 virtual ~GpuChannel(); |
34 | 34 |
35 bool Init(); | 35 bool Init(); |
36 | 36 |
37 std::string GetChannelName(); | 37 std::string GetChannelName(); |
38 | 38 |
| 39 #if defined(OS_POSIX) |
| 40 int GetRendererFileDescriptor(); |
| 41 #endif // defined(OS_POSIX) |
| 42 |
39 base::ProcessHandle renderer_handle() const { | 43 base::ProcessHandle renderer_handle() const { |
40 return renderer_process_.handle(); | 44 return renderer_process_.handle(); |
41 } | 45 } |
42 | 46 |
43 #if defined(OS_POSIX) | |
44 // When first created, the GpuChannel gets assigned the file descriptor | |
45 // for the renderer. | |
46 // After the first time we pass it through the IPC, we don't need it anymore, | |
47 // and we close it. At that time, we reset renderer_fd_ to -1. | |
48 int DisownRendererFd() { | |
49 int value = renderer_fd_; | |
50 renderer_fd_ = -1; | |
51 return value; | |
52 } | |
53 #endif | |
54 | |
55 // IPC::Channel::Listener implementation: | 47 // IPC::Channel::Listener implementation: |
56 virtual void OnMessageReceived(const IPC::Message& msg); | 48 virtual void OnMessageReceived(const IPC::Message& msg); |
57 virtual void OnChannelConnected(int32 peer_pid); | 49 virtual void OnChannelConnected(int32 peer_pid); |
58 virtual void OnChannelError(); | 50 virtual void OnChannelError(); |
59 | 51 |
60 // IPC::Message::Sender implementation: | 52 // IPC::Message::Sender implementation: |
61 virtual bool Send(IPC::Message* msg); | 53 virtual bool Send(IPC::Message* msg); |
62 | 54 |
63 #if defined(OS_MACOSX) | 55 #if defined(OS_MACOSX) |
64 virtual void AcceleratedSurfaceBuffersSwapped( | 56 virtual void AcceleratedSurfaceBuffersSwapped( |
(...skipping 24 matching lines...) Expand all Loading... |
89 void OnDestroyVideoDecoder(int32 decoder_id); | 81 void OnDestroyVideoDecoder(int32 decoder_id); |
90 | 82 |
91 scoped_ptr<IPC::SyncChannel> channel_; | 83 scoped_ptr<IPC::SyncChannel> channel_; |
92 | 84 |
93 // Handle to the renderer process who is on the other side of the channel. | 85 // Handle to the renderer process who is on the other side of the channel. |
94 base::ScopedOpenProcess renderer_process_; | 86 base::ScopedOpenProcess renderer_process_; |
95 | 87 |
96 // The id of the renderer who is on the other side of the channel. | 88 // The id of the renderer who is on the other side of the channel. |
97 int renderer_id_; | 89 int renderer_id_; |
98 | 90 |
99 #if defined(OS_POSIX) | |
100 // FD for the renderer end of the pipe. It is stored until we send it over | |
101 // IPC after which it is cleared. It will be closed by the IPC mechanism. | |
102 int renderer_fd_; | |
103 #endif | |
104 | |
105 // Used to implement message routing functionality to CommandBuffer objects | 91 // Used to implement message routing functionality to CommandBuffer objects |
106 MessageRouter router_; | 92 MessageRouter router_; |
107 | 93 |
108 #if defined(ENABLE_GPU) | 94 #if defined(ENABLE_GPU) |
109 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; | 95 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; |
110 StubMap stubs_; | 96 StubMap stubs_; |
111 #endif | 97 #endif |
112 | 98 |
113 bool log_messages_; // True if we should log sent and received messages. | 99 bool log_messages_; // True if we should log sent and received messages. |
114 | 100 |
115 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 101 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
116 }; | 102 }; |
117 | 103 |
118 #endif // CHROME_GPU_GPU_CHANNEL_H_ | 104 #endif // CHROME_GPU_GPU_CHANNEL_H_ |
OLD | NEW |