Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 { |
|
piman
2011/12/08 07:09:11
nit: braces on both sides of the else.
xhwang
2011/12/08 19:37:49
Done.
| |
| 83 NOTREACHED(); | |
| 83 channel = iter->second; | 84 channel = iter->second; |
| 85 } | |
| 84 | 86 |
| 85 DCHECK(channel != NULL); | 87 DCHECK(channel != NULL); |
| 86 | 88 |
| 87 if (channel->Init(io_message_loop_, shutdown_event_)) | 89 if (channel->Init(io_message_loop_, shutdown_event_)) |
| 88 gpu_channels_[renderer_id] = channel; | 90 gpu_channels_[renderer_id] = channel; |
| 89 else | 91 else |
| 90 channel = NULL; | 92 channel = NULL; |
| 91 | 93 |
| 92 if (channel.get()) { | 94 if (channel.get()) { |
| 93 channel_handle.name = channel->GetChannelName(); | 95 channel_handle.name = channel->GetChannelName(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 void GpuChannelManager::LoseAllContexts() { | 143 void GpuChannelManager::LoseAllContexts() { |
| 142 MessageLoop::current()->PostTask( | 144 MessageLoop::current()->PostTask( |
| 143 FROM_HERE, | 145 FROM_HERE, |
| 144 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 146 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
| 145 weak_factory_.GetWeakPtr())); | 147 weak_factory_.GetWeakPtr())); |
| 146 } | 148 } |
| 147 | 149 |
| 148 void GpuChannelManager::OnLoseAllContexts() { | 150 void GpuChannelManager::OnLoseAllContexts() { |
| 149 gpu_channels_.clear(); | 151 gpu_channels_.clear(); |
| 150 } | 152 } |
| OLD | NEW |