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 #include "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
| 7 #include "base/bind.h" |
7 #include "content/common/child_thread.h" | 8 #include "content/common/child_thread.h" |
8 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
9 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
10 | 11 |
11 GpuChannelManager::GpuChannelManager(ChildThread* gpu_child_thread, | 12 GpuChannelManager::GpuChannelManager(ChildThread* gpu_child_thread, |
12 GpuWatchdog* watchdog, | 13 GpuWatchdog* watchdog, |
13 base::MessageLoopProxy* io_message_loop, | 14 base::MessageLoopProxy* io_message_loop, |
14 base::WaitableEvent* shutdown_event) | 15 base::WaitableEvent* shutdown_event) |
15 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 16 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
16 io_message_loop_(io_message_loop), | 17 io_message_loop_(io_message_loop), |
17 shutdown_event_(shutdown_event), | 18 shutdown_event_(shutdown_event), |
18 gpu_child_thread_(gpu_child_thread), | 19 gpu_child_thread_(gpu_child_thread), |
19 watchdog_(watchdog) { | 20 watchdog_(watchdog) { |
20 DCHECK(gpu_child_thread); | 21 DCHECK(gpu_child_thread); |
21 DCHECK(io_message_loop); | 22 DCHECK(io_message_loop); |
22 DCHECK(shutdown_event); | 23 DCHECK(shutdown_event); |
23 } | 24 } |
24 | 25 |
25 GpuChannelManager::~GpuChannelManager() { | 26 GpuChannelManager::~GpuChannelManager() { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); | 143 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
143 if (iter == gpu_channels_.end()) | 144 if (iter == gpu_channels_.end()) |
144 return; | 145 return; |
145 scoped_refptr<GpuChannel> channel = iter->second; | 146 scoped_refptr<GpuChannel> channel = iter->second; |
146 | 147 |
147 channel->ViewResized(command_buffer_route_id); | 148 channel->ViewResized(command_buffer_route_id); |
148 } | 149 } |
149 | 150 |
150 void GpuChannelManager::LoseAllContexts() { | 151 void GpuChannelManager::LoseAllContexts() { |
151 MessageLoop::current()->PostTask( | 152 MessageLoop::current()->PostTask( |
152 FROM_HERE, method_factory_.NewRunnableMethod( | 153 FROM_HERE, |
153 &GpuChannelManager::OnLoseAllContexts)); | 154 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
| 155 weak_factory_.GetWeakPtr())); |
154 } | 156 } |
155 | 157 |
156 void GpuChannelManager::OnLoseAllContexts() { | 158 void GpuChannelManager::OnLoseAllContexts() { |
157 gpu_channels_.clear(); | 159 gpu_channels_.clear(); |
158 } | 160 } |
OLD | NEW |