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

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

Issue 6793054: Moved code that runs in both the browser and GPU process from content/gpu to content/common/gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_channel_manager.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) 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_GPU_GPU_RENDER_THREAD_H_ 5 #ifndef CONTENT_GPU_GPU_CHANNEL_MANAGER_H_
6 #define CONTENT_GPU_GPU_RENDER_THREAD_H_ 6 #define CONTENT_GPU_GPU_CHANNEL_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/common/child_thread.h" 18 #include "content/common/child_thread.h"
19 #include "content/common/gpu_info.h" 19 #include "content/common/gpu/gpu_channel.h"
20 #include "content/gpu/gpu_channel.h" 20 #include "content/common/gpu/gpu_config.h"
21 #include "content/gpu/gpu_config.h" 21 #include "content/common/gpu/x_util.h"
22 #include "content/gpu/x_util.h"
23 #include "ipc/ipc_channel.h" 22 #include "ipc/ipc_channel.h"
24 #include "ipc/ipc_message.h" 23 #include "ipc/ipc_message.h"
25 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
26 25
27 namespace IPC { 26 namespace IPC {
28 struct ChannelHandle; 27 struct ChannelHandle;
29 } 28 }
30 29
31 // A GpuRenderThread is a thread responsible for issuing rendering commands to 30 // A GpuChannelManager is a thread responsible for issuing rendering commands
32 // a GPU. There is currently only one per GPU process. This might change. Assume 31 // managing the lifetimes of GPU channels and forwarding IPC requests from the
33 // there are many, all running on different threads. 32 // browser process to them based on the corresponding renderer ID.
34 // 33 //
35 // A GpuRenderThread can also be hosted in the browser process in single process 34 // A GpuChannelManager can also be hosted in the browser process in single
36 // or in-process GPU modes. In this case there is no corresponding 35 // process or in-process GPU modes. In this case there is no corresponding
37 // GpuChildThread and this is the reason the GpuChildThread is referenced via 36 // GpuChildThread and this is the reason the GpuChildThread is referenced via
38 // a pointer to IPC::Message::Sender, which can be implemented by other hosts 37 // a pointer to IPC::Message::Sender, which can be implemented by other hosts
39 // to send IPC messages to the browser process IO thread on the 38 // to send IPC messages to the browser process IO thread on the
40 // GpuRenderThread's behalf. 39 // GpuChannelManager's behalf.
41 class GpuRenderThread : public IPC::Channel::Listener, 40 class GpuChannelManager : public IPC::Channel::Listener,
42 public IPC::Message::Sender { 41 public IPC::Message::Sender {
43 public: 42 public:
44 GpuRenderThread(IPC::Message::Sender* browser_channel, 43 GpuChannelManager(IPC::Message::Sender* browser_channel,
45 GpuWatchdogThread* gpu_watchdog_thread, 44 GpuWatchdogThread* gpu_watchdog_thread,
46 MessageLoop* io_message_loop, 45 MessageLoop* io_message_loop,
47 base::WaitableEvent* shutdown_event); 46 base::WaitableEvent* shutdown_event);
48 ~GpuRenderThread(); 47 ~GpuChannelManager();
49 48
50 // Remove the channel for a particular renderer. 49 // Remove the channel for a particular renderer.
51 void RemoveChannel(int renderer_id); 50 void RemoveChannel(int renderer_id);
52 51
53 // Listener overrides. 52 // Listener overrides.
54 virtual bool OnMessageReceived(const IPC::Message& msg); 53 virtual bool OnMessageReceived(const IPC::Message& msg);
55 54
56 // Sender overrides. 55 // Sender overrides.
57 virtual bool Send(IPC::Message* msg); 56 virtual bool Send(IPC::Message* msg);
58 57
59 private: 58 private:
60 // Message handlers. 59 // Message handlers.
61 void OnEstablishChannel(int renderer_id); 60 void OnEstablishChannel(int renderer_id);
62 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); 61 void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
63 void OnSynchronize(); 62 void OnSynchronize();
64 void OnCreateViewCommandBuffer( 63 void OnCreateViewCommandBuffer(
65 gfx::PluginWindowHandle window, 64 gfx::PluginWindowHandle window,
66 int32 render_view_id, 65 int32 render_view_id,
67 int32 renderer_id, 66 int32 renderer_id,
68 const GPUCreateCommandBufferConfig& init_params); 67 const GPUCreateCommandBufferConfig& init_params);
69 #if defined(OS_MACOSX) 68 #if defined(OS_MACOSX)
70 void OnAcceleratedSurfaceBuffersSwappedACK( 69 void OnAcceleratedSurfaceBuffersSwappedACK(
71 int renderer_id, int32 route_id, uint64 swap_buffers_count); 70 int renderer_id, int32 route_id, uint64 swap_buffers_count);
72 void OnDestroyCommandBuffer(int renderer_id, int32 renderer_view_id); 71 void OnDestroyCommandBuffer(int renderer_id, int32 renderer_view_id);
73 #endif 72 #endif
74 73
75 MessageLoop* io_message_loop_; 74 MessageLoop* io_message_loop_;
76 base::WaitableEvent* shutdown_event_; 75 base::WaitableEvent* shutdown_event_;
77 76
78 // Either an IPC channel to the browser or, if the GpuRenderThread is 77 // Either an IPC channel to the browser or, if the GpuChannelManager is
79 // running in the browser process, a Sender implementation that will post 78 // running in the browser process, a Sender implementation that will post
80 // IPC messages to the UI thread. 79 // IPC messages to the UI thread.
81 IPC::Message::Sender* browser_channel_; 80 IPC::Message::Sender* browser_channel_;
82 81
83 // These objects manage channels to individual renderer processes there is 82 // These objects manage channels to individual renderer processes there is
84 // one channel for each renderer process that has connected to this GPU 83 // one channel for each renderer process that has connected to this GPU
85 // process. 84 // process.
86 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; 85 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap;
87 GpuChannelMap gpu_channels_; 86 GpuChannelMap gpu_channels_;
88 GpuWatchdogThread* watchdog_thread_; 87 GpuWatchdogThread* watchdog_thread_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(GpuRenderThread); 89 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager);
91 }; 90 };
92 91
93 #endif // CONTENT_GPU_GPU_RENDER_THREAD_H_ 92 #endif // CONTENT_GPU_GPU_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698