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