Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: content/common/gpu/gpu_channel.h

Issue 9958034: Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_COMMON_GPU_GPU_CHANNEL_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return gpu_channel_manager_; 55 return gpu_channel_manager_;
56 } 56 }
57 57
58 // Returns the name of the associated IPC channel. 58 // Returns the name of the associated IPC channel.
59 std::string GetChannelName(); 59 std::string GetChannelName();
60 60
61 #if defined(OS_POSIX) 61 #if defined(OS_POSIX)
62 int TakeRendererFileDescriptor(); 62 int TakeRendererFileDescriptor();
63 #endif // defined(OS_POSIX) 63 #endif // defined(OS_POSIX)
64 64
65 base::ProcessHandle renderer_process() const { 65 base::ProcessId renderer_pid() const { return channel_->peer_pid(); }
66 return renderer_process_;
67 }
68 66
69 // IPC::Channel::Listener implementation: 67 // IPC::Channel::Listener implementation:
70 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 68 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
71 virtual void OnChannelError() OVERRIDE; 69 virtual void OnChannelError() OVERRIDE;
72 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
73 70
74 // IPC::Message::Sender implementation: 71 // IPC::Message::Sender implementation:
75 virtual bool Send(IPC::Message* msg) OVERRIDE; 72 virtual bool Send(IPC::Message* msg) OVERRIDE;
76 73
77 virtual void AppendAllCommandBufferStubs( 74 virtual void AppendAllCommandBufferStubs(
78 std::vector<GpuCommandBufferStubBase*>& stubs); 75 std::vector<GpuCommandBufferStubBase*>& stubs);
79 76
80 // This is called when a command buffer transitions from the unscheduled 77 // This is called when a command buffer transitions from the unscheduled
81 // state to the scheduled state, which potentially means the channel 78 // state to the scheduled state, which potentially means the channel
82 // transitions from the unscheduled to the scheduled state. When this occurs 79 // transitions from the unscheduled to the scheduled state. When this occurs
(...skipping 29 matching lines...) Expand all
112 private: 109 private:
113 void OnDestroy(); 110 void OnDestroy();
114 111
115 bool OnControlMessageReceived(const IPC::Message& msg); 112 bool OnControlMessageReceived(const IPC::Message& msg);
116 113
117 void HandleMessage(); 114 void HandleMessage();
118 void PollWork(int route_id); 115 void PollWork(int route_id);
119 void ScheduleDelayedWork(GpuCommandBufferStub *stub, int64 delay); 116 void ScheduleDelayedWork(GpuCommandBufferStub *stub, int64 delay);
120 117
121 // Message handlers. 118 // Message handlers.
122 void OnInitialize(base::ProcessHandle renderer_process);
123 void OnCreateOffscreenCommandBuffer( 119 void OnCreateOffscreenCommandBuffer(
124 const gfx::Size& size, 120 const gfx::Size& size,
125 const GPUCreateCommandBufferConfig& init_params, 121 const GPUCreateCommandBufferConfig& init_params,
126 IPC::Message* reply_message); 122 IPC::Message* reply_message);
127 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message); 123 void OnDestroyCommandBuffer(int32 route_id, IPC::Message* reply_message);
128 124
129 void OnWillGpuSwitchOccur(bool is_creating_context, 125 void OnWillGpuSwitchOccur(bool is_creating_context,
130 gfx::GpuPreference gpu_preference, 126 gfx::GpuPreference gpu_preference,
131 IPC::Message* reply_message); 127 IPC::Message* reply_message);
132 void OnCloseChannel(); 128 void OnCloseChannel();
133 129
134 void WillCreateCommandBuffer(gfx::GpuPreference gpu_preference); 130 void WillCreateCommandBuffer(gfx::GpuPreference gpu_preference);
135 void DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference); 131 void DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference);
136 132
137 // The lifetime of objects of this class is managed by a GpuChannelManager. 133 // The lifetime of objects of this class is managed by a GpuChannelManager.
138 // The GpuChannelManager destroy all the GpuChannels that they own when they 134 // The GpuChannelManager destroy all the GpuChannels that they own when they
139 // are destroyed. So a raw pointer is safe. 135 // are destroyed. So a raw pointer is safe.
140 GpuChannelManager* gpu_channel_manager_; 136 GpuChannelManager* gpu_channel_manager_;
141 137
142 scoped_ptr<IPC::SyncChannel> channel_; 138 scoped_ptr<IPC::SyncChannel> channel_;
143 139
144 std::deque<IPC::Message*> deferred_messages_; 140 std::deque<IPC::Message*> deferred_messages_;
145 141
146 // The id of the client who is on the other side of the channel. 142 // The id of the client who is on the other side of the channel.
147 int client_id_; 143 int client_id_;
148 144
149 // Uniquely identifies the channel within this GPU process. 145 // Uniquely identifies the channel within this GPU process.
150 std::string channel_id_; 146 std::string channel_id_;
151 147
152 // Handle to the renderer process that is on the other side of the channel.
153 base::ProcessHandle renderer_process_;
154
155 // The process id of the renderer process.
156 base::ProcessId renderer_pid_;
157
158 // Used to implement message routing functionality to CommandBuffer objects 148 // Used to implement message routing functionality to CommandBuffer objects
159 MessageRouter router_; 149 MessageRouter router_;
160 150
161 // The share group that all contexts associated with a particular renderer 151 // The share group that all contexts associated with a particular renderer
162 // process use. 152 // process use.
163 scoped_refptr<gfx::GLShareGroup> share_group_; 153 scoped_refptr<gfx::GLShareGroup> share_group_;
164 154
165 #if defined(ENABLE_GPU) 155 #if defined(ENABLE_GPU)
166 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap; 156 typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap;
167 StubMap stubs_; 157 StubMap stubs_;
168 #endif // defined (ENABLE_GPU) 158 #endif // defined (ENABLE_GPU)
169 159
170 bool log_messages_; // True if we should log sent and received messages. 160 bool log_messages_; // True if we should log sent and received messages.
171 gpu::gles2::DisallowedFeatures disallowed_features_; 161 gpu::gles2::DisallowedFeatures disallowed_features_;
172 GpuWatchdog* watchdog_; 162 GpuWatchdog* watchdog_;
173 bool software_; 163 bool software_;
174 bool handle_messages_scheduled_; 164 bool handle_messages_scheduled_;
175 bool processed_get_state_fast_; 165 bool processed_get_state_fast_;
176 int32 num_contexts_preferring_discrete_gpu_; 166 int32 num_contexts_preferring_discrete_gpu_;
177 167
178 base::WeakPtrFactory<GpuChannel> weak_factory_; 168 base::WeakPtrFactory<GpuChannel> weak_factory_;
179 169
180 DISALLOW_COPY_AND_ASSIGN(GpuChannel); 170 DISALLOW_COPY_AND_ASSIGN(GpuChannel);
181 }; 171 };
182 172
183 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 173 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698