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

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

Issue 12226039: Reland 179911 and 179910 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src
Patch Set: Delta from original landing that's necessary for M25 (not ToT) Created 7 years, 10 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
« no previous file with comments | « no previous file | content/common/gpu/gpu_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 18 matching lines...) Expand all
29 #endif 29 #endif
30 30
31 struct GPUCreateCommandBufferConfig; 31 struct GPUCreateCommandBufferConfig;
32 32
33 namespace base { 33 namespace base {
34 class MessageLoopProxy; 34 class MessageLoopProxy;
35 class WaitableEvent; 35 class WaitableEvent;
36 } 36 }
37 37
38 namespace gpu { 38 namespace gpu {
39 struct RefCountedCounter; 39 class PreemptionFlag;
40 namespace gles2 { 40 namespace gles2 {
41 class ImageManager; 41 class ImageManager;
42 } 42 }
43 } 43 }
44 44
45 #if defined(OS_ANDROID) 45 #if defined(OS_ANDROID)
46 namespace content { 46 namespace content {
47 class StreamTextureManagerAndroid; 47 class StreamTextureManagerAndroid;
48 } 48 }
49 #endif 49 #endif
50 50
51 namespace content { 51 namespace content {
52 class GpuChannelManager; 52 class GpuChannelManager;
53 class GpuWatchdog; 53 class GpuWatchdog;
54 class SyncPointMessageFilter;
54 55
55 // Encapsulates an IPC channel between the GPU process and one renderer 56 // Encapsulates an IPC channel between the GPU process and one renderer
56 // process. On the renderer side there's a corresponding GpuChannelHost. 57 // process. On the renderer side there's a corresponding GpuChannelHost.
57 class GpuChannel : public IPC::Listener, 58 class GpuChannel : public IPC::Listener,
58 public IPC::Sender, 59 public IPC::Sender,
59 public base::RefCountedThreadSafe<GpuChannel> { 60 public base::RefCountedThreadSafe<GpuChannel> {
60 public: 61 public:
61 // Takes ownership of the renderer process handle. 62 // Takes ownership of the renderer process handle.
62 GpuChannel(GpuChannelManager* gpu_channel_manager, 63 GpuChannel(GpuChannelManager* gpu_channel_manager,
63 GpuWatchdog* watchdog, 64 GpuWatchdog* watchdog,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Destroy channel and all contained contexts. 123 // Destroy channel and all contained contexts.
123 void DestroySoon(); 124 void DestroySoon();
124 125
125 // Generate a route ID guaranteed to be unique for this channel. 126 // Generate a route ID guaranteed to be unique for this channel.
126 int GenerateRouteID(); 127 int GenerateRouteID();
127 128
128 // Called to add/remove a listener for a particular message routing ID. 129 // Called to add/remove a listener for a particular message routing ID.
129 void AddRoute(int32 route_id, IPC::Listener* listener); 130 void AddRoute(int32 route_id, IPC::Listener* listener);
130 void RemoveRoute(int32 route_id); 131 void RemoveRoute(int32 route_id);
131 132
132 gpu::RefCountedCounter* MessagesPendingCount() { 133 gpu::PreemptionFlag* GetPreemptionFlag() {
133 return unprocessed_messages_.get(); 134 return processing_stalled_.get();
134 } 135 }
135 136
136 // If preempt_by_counter->count is non-zero, any stub on this channel 137 // If |preemption_flag->IsSet()|, any stub on this channel
137 // should stop issuing GL commands. Setting this to NULL stops deferral. 138 // should stop issuing GL commands. Setting this to NULL stops deferral.
138 void SetPreemptByCounter( 139 void SetPreemptByFlag(
139 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter); 140 scoped_refptr<gpu::PreemptionFlag> preemption_flag);
140 141
141 #if defined(OS_ANDROID) 142 #if defined(OS_ANDROID)
142 StreamTextureManagerAndroid* stream_texture_manager() { 143 StreamTextureManagerAndroid* stream_texture_manager() {
143 return stream_texture_manager_.get(); 144 return stream_texture_manager_.get();
144 } 145 }
145 #endif 146 #endif
146 147
147 protected: 148 protected:
148 virtual ~GpuChannel(); 149 virtual ~GpuChannel();
149 150
(...skipping 23 matching lines...) Expand all
173 // through binder thread. 174 // through binder thread.
174 void OnEstablishStreamTexture( 175 void OnEstablishStreamTexture(
175 int32 stream_id, SurfaceTexturePeer::SurfaceTextureTarget type, 176 int32 stream_id, SurfaceTexturePeer::SurfaceTextureTarget type,
176 int32 primary_id, int32 secondary_id); 177 int32 primary_id, int32 secondary_id);
177 #endif 178 #endif
178 179
179 // Collect rendering stats. 180 // Collect rendering stats.
180 void OnCollectRenderingStatsForSurface( 181 void OnCollectRenderingStatsForSurface(
181 int32 surface_id, IPC::Message* reply_message); 182 int32 surface_id, IPC::Message* reply_message);
182 183
184 // Decrement the count of unhandled IPC messages and defer preemption.
185 void MessageProcessed();
186
183 // The lifetime of objects of this class is managed by a GpuChannelManager. 187 // The lifetime of objects of this class is managed by a GpuChannelManager.
184 // The GpuChannelManager destroy all the GpuChannels that they own when they 188 // The GpuChannelManager destroy all the GpuChannels that they own when they
185 // are destroyed. So a raw pointer is safe. 189 // are destroyed. So a raw pointer is safe.
186 GpuChannelManager* gpu_channel_manager_; 190 GpuChannelManager* gpu_channel_manager_;
187 191
188 scoped_ptr<IPC::SyncChannel> channel_; 192 scoped_ptr<IPC::SyncChannel> channel_;
189 193
190 // Number of routed messages for pending processing on a stub. 194 // Pointer to number of routed messages that are pending processing on a
191 scoped_refptr<gpu::RefCountedCounter> unprocessed_messages_; 195 // stub. The lifetime is properly managed because we pass ownership to a
196 // SyncPointMessageFilter, which we hold a reference to.
197 base::AtomicRefCount* unprocessed_messages_;
198
199 // Whether the processing of IPCs on this channel is stalled.
200 scoped_refptr<gpu::PreemptionFlag> processing_stalled_;
192 201
193 // If non-NULL, all stubs on this channel should stop processing GL 202 // If non-NULL, all stubs on this channel should stop processing GL
194 // commands (via their GpuScheduler) when preempt_by_counter_->count 203 // commands (via their GpuScheduler) when preemption_flag_->IsSet()
195 // is non-zero. 204 scoped_refptr<gpu::PreemptionFlag> preemption_flag_;
196 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_;
197 205
198 std::deque<IPC::Message*> deferred_messages_; 206 std::deque<IPC::Message*> deferred_messages_;
199 207
200 // The id of the client who is on the other side of the channel. 208 // The id of the client who is on the other side of the channel.
201 int client_id_; 209 int client_id_;
202 210
203 // Uniquely identifies the channel within this GPU process. 211 // Uniquely identifies the channel within this GPU process.
204 std::string channel_id_; 212 std::string channel_id_;
205 213
206 // Used to implement message routing functionality to CommandBuffer objects 214 // Used to implement message routing functionality to CommandBuffer objects
(...skipping 18 matching lines...) Expand all
225 bool handle_messages_scheduled_; 233 bool handle_messages_scheduled_;
226 bool processed_get_state_fast_; 234 bool processed_get_state_fast_;
227 IPC::Message* currently_processing_message_; 235 IPC::Message* currently_processing_message_;
228 236
229 #if defined(OS_ANDROID) 237 #if defined(OS_ANDROID)
230 scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_; 238 scoped_ptr<StreamTextureManagerAndroid> stream_texture_manager_;
231 #endif 239 #endif
232 240
233 base::WeakPtrFactory<GpuChannel> weak_factory_; 241 base::WeakPtrFactory<GpuChannel> weak_factory_;
234 242
243 scoped_refptr<SyncPointMessageFilter> filter_;
244 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
245
235 DISALLOW_COPY_AND_ASSIGN(GpuChannel); 246 DISALLOW_COPY_AND_ASSIGN(GpuChannel);
236 }; 247 };
237 248
238 } // namespace content 249 } // namespace content
239 250
240 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 251 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698