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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 gpu_channels_[renderer_id] = channel; | 88 gpu_channels_[renderer_id] = channel; |
89 else | 89 else |
90 channel = NULL; | 90 channel = NULL; |
91 | 91 |
92 if (channel.get()) { | 92 if (channel.get()) { |
93 channel_handle.name = channel->GetChannelName(); | 93 channel_handle.name = channel->GetChannelName(); |
94 #if defined(OS_POSIX) | 94 #if defined(OS_POSIX) |
95 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so | 95 // On POSIX, pass the renderer-side FD. Also mark it as auto-close so |
96 // that it gets closed after it has been sent. | 96 // that it gets closed after it has been sent. |
97 int renderer_fd = channel->TakeRendererFileDescriptor(); | 97 int renderer_fd = channel->TakeRendererFileDescriptor(); |
98 DCHECK_NE(-1, renderer_fd); | 98 // Check the validity of |renderer_fd| for bug investigation. Replace with |
| 99 // normal error handling after bug fixed. See for details: crbug.com/95732. |
| 100 CHECK_NE(-1, renderer_fd); |
99 channel_handle.socket = base::FileDescriptor(renderer_fd, true); | 101 channel_handle.socket = base::FileDescriptor(renderer_fd, true); |
100 #endif | 102 #endif |
101 } | 103 } |
102 | 104 |
103 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); | 105 Send(new GpuHostMsg_ChannelEstablished(channel_handle)); |
104 } | 106 } |
105 | 107 |
106 void GpuChannelManager::OnCloseChannel( | 108 void GpuChannelManager::OnCloseChannel( |
107 const IPC::ChannelHandle& channel_handle) { | 109 const IPC::ChannelHandle& channel_handle) { |
108 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 110 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
(...skipping 30 matching lines...) Expand all Loading... |
139 void GpuChannelManager::LoseAllContexts() { | 141 void GpuChannelManager::LoseAllContexts() { |
140 MessageLoop::current()->PostTask( | 142 MessageLoop::current()->PostTask( |
141 FROM_HERE, | 143 FROM_HERE, |
142 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 144 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
143 weak_factory_.GetWeakPtr())); | 145 weak_factory_.GetWeakPtr())); |
144 } | 146 } |
145 | 147 |
146 void GpuChannelManager::OnLoseAllContexts() { | 148 void GpuChannelManager::OnLoseAllContexts() { |
147 gpu_channels_.clear(); | 149 gpu_channels_.clear(); |
148 } | 150 } |
OLD | NEW |