OLD | NEW |
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_CHANNEL_MANAGER_H_ | 5 #ifndef CONTENT_GPU_GPU_CHANNEL_MANAGER_H_ |
6 #define CONTENT_GPU_GPU_CHANNEL_MANAGER_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/message_loop_proxy.h" |
16 #include "base/time.h" | 17 #include "base/time.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "content/common/child_thread.h" | 19 #include "content/common/child_thread.h" |
19 #include "content/common/gpu/gpu_channel.h" | 20 #include "content/common/gpu/gpu_channel.h" |
20 #include "content/common/gpu/gpu_config.h" | 21 #include "content/common/gpu/gpu_config.h" |
21 #include "content/common/gpu/x_util.h" | 22 #include "content/common/gpu/x_util.h" |
22 #include "ipc/ipc_channel.h" | 23 #include "ipc/ipc_channel.h" |
23 #include "ipc/ipc_message.h" | 24 #include "ipc/ipc_message.h" |
24 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
25 | 26 |
(...skipping 11 matching lines...) Expand all Loading... |
37 // process or in-process GPU modes. In this case there is no corresponding | 38 // process or in-process GPU modes. In this case there is no corresponding |
38 // GpuChildThread and this is the reason the GpuChildThread is referenced via | 39 // GpuChildThread and this is the reason the GpuChildThread is referenced via |
39 // a pointer to IPC::Message::Sender, which can be implemented by other hosts | 40 // a pointer to IPC::Message::Sender, which can be implemented by other hosts |
40 // to send IPC messages to the browser process IO thread on the | 41 // to send IPC messages to the browser process IO thread on the |
41 // GpuChannelManager's behalf. | 42 // GpuChannelManager's behalf. |
42 class GpuChannelManager : public IPC::Channel::Listener, | 43 class GpuChannelManager : public IPC::Channel::Listener, |
43 public IPC::Message::Sender { | 44 public IPC::Message::Sender { |
44 public: | 45 public: |
45 GpuChannelManager(IPC::Message::Sender* browser_channel, | 46 GpuChannelManager(IPC::Message::Sender* browser_channel, |
46 GpuWatchdog* watchdog, | 47 GpuWatchdog* watchdog, |
47 MessageLoop* io_message_loop, | 48 base::MessageLoopProxy* io_message_loop, |
48 base::WaitableEvent* shutdown_event); | 49 base::WaitableEvent* shutdown_event); |
49 ~GpuChannelManager(); | 50 ~GpuChannelManager(); |
50 | 51 |
51 // Remove the channel for a particular renderer. | 52 // Remove the channel for a particular renderer. |
52 void RemoveChannel(int renderer_id); | 53 void RemoveChannel(int renderer_id); |
53 | 54 |
54 // Listener overrides. | 55 // Listener overrides. |
55 virtual bool OnMessageReceived(const IPC::Message& msg); | 56 virtual bool OnMessageReceived(const IPC::Message& msg); |
56 | 57 |
57 // Sender overrides. | 58 // Sender overrides. |
(...skipping 17 matching lines...) Expand all Loading... |
75 const GPUCreateCommandBufferConfig& init_params); | 76 const GPUCreateCommandBufferConfig& init_params); |
76 void OnResizeViewACK(int32 renderer_id, int32 command_buffer_route_id); | 77 void OnResizeViewACK(int32 renderer_id, int32 command_buffer_route_id); |
77 #if defined(OS_MACOSX) | 78 #if defined(OS_MACOSX) |
78 void OnAcceleratedSurfaceBuffersSwappedACK( | 79 void OnAcceleratedSurfaceBuffersSwappedACK( |
79 int renderer_id, int32 route_id, uint64 swap_buffers_count); | 80 int renderer_id, int32 route_id, uint64 swap_buffers_count); |
80 void OnDestroyCommandBuffer(int renderer_id, int32 renderer_view_id); | 81 void OnDestroyCommandBuffer(int renderer_id, int32 renderer_view_id); |
81 #endif | 82 #endif |
82 | 83 |
83 void OnLoseAllContexts(); | 84 void OnLoseAllContexts(); |
84 | 85 |
85 MessageLoop* io_message_loop_; | 86 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
86 base::WaitableEvent* shutdown_event_; | 87 base::WaitableEvent* shutdown_event_; |
87 | 88 |
88 // Either an IPC channel to the browser or, if the GpuChannelManager is | 89 // Either an IPC channel to the browser or, if the GpuChannelManager is |
89 // running in the browser process, a Sender implementation that will post | 90 // running in the browser process, a Sender implementation that will post |
90 // IPC messages to the UI thread. | 91 // IPC messages to the UI thread. |
91 IPC::Message::Sender* browser_channel_; | 92 IPC::Message::Sender* browser_channel_; |
92 | 93 |
93 // These objects manage channels to individual renderer processes there is | 94 // These objects manage channels to individual renderer processes there is |
94 // one channel for each renderer process that has connected to this GPU | 95 // one channel for each renderer process that has connected to this GPU |
95 // process. | 96 // process. |
96 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | 97 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
97 GpuChannelMap gpu_channels_; | 98 GpuChannelMap gpu_channels_; |
98 GpuWatchdog* watchdog_; | 99 GpuWatchdog* watchdog_; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 101 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
101 }; | 102 }; |
102 | 103 |
103 #endif // CONTENT_GPU_GPU_CHANNEL_MANAGER_H_ | 104 #endif // CONTENT_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |