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 "base/bind.h" |
8 #include "content/common/child_thread.h" | 8 #include "content/common/child_thread.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bool GpuChannelManager::Send(IPC::Message* msg) { | 70 bool GpuChannelManager::Send(IPC::Message* msg) { |
71 return gpu_child_thread_->Send(msg); | 71 return gpu_child_thread_->Send(msg); |
72 } | 72 } |
73 | 73 |
74 void GpuChannelManager::OnEstablishChannel(int renderer_id) { | 74 void GpuChannelManager::OnEstablishChannel(int renderer_id) { |
75 scoped_refptr<GpuChannel> channel; | 75 scoped_refptr<GpuChannel> channel; |
76 IPC::ChannelHandle channel_handle; | 76 IPC::ChannelHandle channel_handle; |
77 content::GPUInfo gpu_info; | 77 content::GPUInfo gpu_info; |
78 | 78 |
79 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); | 79 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
80 if (iter == gpu_channels_.end()) | 80 if (iter == gpu_channels_.end()) { |
81 channel = new GpuChannel(this, watchdog_, renderer_id, false); | 81 channel = new GpuChannel(this, watchdog_, renderer_id, false); |
82 else | 82 } else { |
| 83 // TODO(xhwang): Added to investigate crbug.com/95732. Clean up after fixed. |
| 84 CHECK(false); |
83 channel = iter->second; | 85 channel = iter->second; |
| 86 } |
84 | 87 |
85 DCHECK(channel != NULL); | 88 DCHECK(channel != NULL); |
86 | 89 |
87 if (channel->Init(io_message_loop_, shutdown_event_)) | 90 if (channel->Init(io_message_loop_, shutdown_event_)) |
88 gpu_channels_[renderer_id] = channel; | 91 gpu_channels_[renderer_id] = channel; |
89 else | 92 else |
90 channel = NULL; | 93 channel = NULL; |
91 | 94 |
92 if (channel.get()) { | 95 if (channel.get()) { |
93 channel_handle.name = channel->GetChannelName(); | 96 channel_handle.name = channel->GetChannelName(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void GpuChannelManager::LoseAllContexts() { | 144 void GpuChannelManager::LoseAllContexts() { |
142 MessageLoop::current()->PostTask( | 145 MessageLoop::current()->PostTask( |
143 FROM_HERE, | 146 FROM_HERE, |
144 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 147 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
145 weak_factory_.GetWeakPtr())); | 148 weak_factory_.GetWeakPtr())); |
146 } | 149 } |
147 | 150 |
148 void GpuChannelManager::OnLoseAllContexts() { | 151 void GpuChannelManager::OnLoseAllContexts() { |
149 gpu_channels_.clear(); | 152 gpu_channels_.clear(); |
150 } | 153 } |
OLD | NEW |