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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.h

Issue 245443005: Move IPC::MessageFilter and router to a separate file (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pre-review cleanups Created 6 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_CLIENT_GPU_CHANNEL_HOST_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/atomic_sequence_num.h" 11 #include "base/atomic_sequence_num.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/common/gpu/gpu_process_launch_causes.h" 19 #include "content/common/gpu/gpu_process_launch_causes.h"
20 #include "content/common/message_router.h" 20 #include "content/common/message_router.h"
21 #include "gpu/config/gpu_info.h" 21 #include "gpu/config/gpu_info.h"
22 #include "ipc/ipc_channel_handle.h" 22 #include "ipc/ipc_channel_handle.h"
23 #include "ipc/ipc_channel_proxy.h" 23 #include "ipc/ipc_message_filter.h"
24 #include "ipc/ipc_sync_channel.h" 24 #include "ipc/ipc_sync_channel.h"
25 #include "ui/gfx/gpu_memory_buffer.h" 25 #include "ui/gfx/gpu_memory_buffer.h"
26 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
27 #include "ui/gfx/size.h" 27 #include "ui/gfx/size.h"
28 #include "ui/gl/gpu_preference.h" 28 #include "ui/gl/gpu_preference.h"
29 29
30 class GURL; 30 class GURL;
31 class TransportTextureService; 31 class TransportTextureService;
32 struct GPUCreateCommandBufferConfig; 32 struct GPUCreateCommandBufferConfig;
33 33
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 friend class base::RefCountedThreadSafe<GpuChannelHost>; 170 friend class base::RefCountedThreadSafe<GpuChannelHost>;
171 GpuChannelHost(GpuChannelHostFactory* factory, 171 GpuChannelHost(GpuChannelHostFactory* factory,
172 const gpu::GPUInfo& gpu_info); 172 const gpu::GPUInfo& gpu_info);
173 virtual ~GpuChannelHost(); 173 virtual ~GpuChannelHost();
174 void Connect(const IPC::ChannelHandle& channel_handle, 174 void Connect(const IPC::ChannelHandle& channel_handle,
175 base::WaitableEvent* shutdown_event); 175 base::WaitableEvent* shutdown_event);
176 176
177 // A filter used internally to route incoming messages from the IO thread 177 // A filter used internally to route incoming messages from the IO thread
178 // to the correct message loop. It also maintains some shared state between 178 // to the correct message loop. It also maintains some shared state between
179 // all the contexts. 179 // all the contexts.
180 class MessageFilter : public IPC::ChannelProxy::MessageFilter { 180 class MessageFilter : public IPC::MessageFilter {
181 public: 181 public:
182 MessageFilter(); 182 MessageFilter();
183 183
184 // Called on the IO thread. 184 // Called on the IO thread.
185 void AddRoute(int route_id, 185 void AddRoute(int route_id,
186 base::WeakPtr<IPC::Listener> listener, 186 base::WeakPtr<IPC::Listener> listener,
187 scoped_refptr<base::MessageLoopProxy> loop); 187 scoped_refptr<base::MessageLoopProxy> loop);
188 // Called on the IO thread. 188 // Called on the IO thread.
189 void RemoveRoute(int route_id); 189 void RemoveRoute(int route_id);
190 190
191 // IPC::ChannelProxy::MessageFilter implementation 191 // IPC::MessageFilter implementation
192 // (called on the IO thread): 192 // (called on the IO thread):
193 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 193 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
194 virtual void OnChannelError() OVERRIDE; 194 virtual void OnChannelError() OVERRIDE;
195 195
196 // The following methods can be called on any thread. 196 // The following methods can be called on any thread.
197 197
198 // Whether the channel is lost. 198 // Whether the channel is lost.
199 bool IsLost() const; 199 bool IsLost() const;
200 200
201 private: 201 private:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // Used to look up a proxy from its routing id. 243 // Used to look up a proxy from its routing id.
244 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; 244 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
245 ProxyMap proxies_; 245 ProxyMap proxies_;
246 246
247 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 247 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
248 }; 248 };
249 249
250 } // namespace content 250 } // namespace content
251 251
252 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 252 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698