OLD | NEW |
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 #include "content/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 base::IgnoreResult(&IPC::Listener::OnMessageReceived), | 279 base::IgnoreResult(&IPC::Listener::OnMessageReceived), |
280 info.listener, | 280 info.listener, |
281 message)); | 281 message)); |
282 } | 282 } |
283 | 283 |
284 return true; | 284 return true; |
285 } | 285 } |
286 | 286 |
287 void GpuChannelHost::MessageFilter::OnChannelError() { | 287 void GpuChannelHost::MessageFilter::OnChannelError() { |
288 DCHECK(parent_->factory_->IsIOThread()); | 288 DCHECK(parent_->factory_->IsIOThread()); |
| 289 |
| 290 // Post the task to signal the GpuChannelHost before the proxies. That way, if |
| 291 // they themselves post a task to recreate the context, they will not try to |
| 292 // re-use this channel host before it has a chance to mark itself lost. |
| 293 MessageLoop* main_loop = parent_->factory_->GetMainLoop(); |
| 294 main_loop->PostTask(FROM_HERE, |
| 295 base::Bind(&GpuChannelHost::OnChannelError, parent_)); |
289 // Inform all the proxies that an error has occurred. This will be reported | 296 // Inform all the proxies that an error has occurred. This will be reported |
290 // via OpenGL as a lost context. | 297 // via OpenGL as a lost context. |
291 for (ListenerMap::iterator it = listeners_.begin(); | 298 for (ListenerMap::iterator it = listeners_.begin(); |
292 it != listeners_.end(); | 299 it != listeners_.end(); |
293 it++) { | 300 it++) { |
294 const GpuListenerInfo& info = it->second; | 301 const GpuListenerInfo& info = it->second; |
295 info.loop->PostTask( | 302 info.loop->PostTask( |
296 FROM_HERE, | 303 FROM_HERE, |
297 base::Bind(&IPC::Listener::OnChannelError, info.listener)); | 304 base::Bind(&IPC::Listener::OnChannelError, info.listener)); |
298 } | 305 } |
299 | 306 |
300 listeners_.clear(); | 307 listeners_.clear(); |
301 | |
302 MessageLoop* main_loop = parent_->factory_->GetMainLoop(); | |
303 main_loop->PostTask(FROM_HERE, | |
304 base::Bind(&GpuChannelHost::OnChannelError, parent_)); | |
305 } | 308 } |
306 | 309 |
307 | 310 |
OLD | NEW |