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_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
14 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class WaitableEvent; | 19 class WaitableEvent; |
19 } | 20 } |
20 | 21 |
(...skipping 29 matching lines...) Expand all Loading... |
50 void RemoveChannel(int renderer_id); | 51 void RemoveChannel(int renderer_id); |
51 | 52 |
52 // Listener overrides. | 53 // Listener overrides. |
53 virtual bool OnMessageReceived(const IPC::Message& msg); | 54 virtual bool OnMessageReceived(const IPC::Message& msg); |
54 | 55 |
55 // Sender overrides. | 56 // Sender overrides. |
56 virtual bool Send(IPC::Message* msg); | 57 virtual bool Send(IPC::Message* msg); |
57 | 58 |
58 void LoseAllContexts(); | 59 void LoseAllContexts(); |
59 | 60 |
60 ScopedRunnableMethodFactory<GpuChannelManager> method_factory_; | 61 base::WeakPtrFactory<GpuChannelManager> weak_factory_; |
61 | 62 |
62 int GenerateRouteID(); | 63 int GenerateRouteID(); |
63 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 64 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
64 void RemoveRoute(int32 routing_id); | 65 void RemoveRoute(int32 routing_id); |
65 | 66 |
66 GpuChannel* LookupChannel(int32 renderer_id); | 67 GpuChannel* LookupChannel(int32 renderer_id); |
67 | 68 |
68 private: | 69 private: |
69 // Message handlers. | 70 // Message handlers. |
70 void OnEstablishChannel(int renderer_id); | 71 void OnEstablishChannel(int renderer_id); |
(...skipping 19 matching lines...) Expand all Loading... |
90 // one channel for each renderer process that has connected to this GPU | 91 // one channel for each renderer process that has connected to this GPU |
91 // process. | 92 // process. |
92 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; | 93 typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; |
93 GpuChannelMap gpu_channels_; | 94 GpuChannelMap gpu_channels_; |
94 GpuWatchdog* watchdog_; | 95 GpuWatchdog* watchdog_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); | 97 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); |
97 }; | 98 }; |
98 | 99 |
99 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ | 100 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ |
OLD | NEW |