Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 10081018: Revert 132218 - Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/gpu/gpu_data_manager_impl.h" 8 #include "content/browser/gpu/gpu_data_manager_impl.h"
9 #include "content/browser/gpu/gpu_process_host.h" 9 #include "content/browser/gpu/gpu_process_host.h"
10 #include "content/browser/gpu/gpu_surface_tracker.h" 10 #include "content/browser/gpu/gpu_surface_tracker.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 gpu_client_id_, 146 gpu_client_id_,
147 true, 147 true,
148 base::Bind(&BrowserGpuChannelHostFactory::GpuChannelEstablishedOnIO, 148 base::Bind(&BrowserGpuChannelHostFactory::GpuChannelEstablishedOnIO,
149 request)); 149 request));
150 } 150 }
151 151
152 // static 152 // static
153 void BrowserGpuChannelHostFactory::GpuChannelEstablishedOnIO( 153 void BrowserGpuChannelHostFactory::GpuChannelEstablishedOnIO(
154 EstablishRequest* request, 154 EstablishRequest* request,
155 const IPC::ChannelHandle& channel_handle, 155 const IPC::ChannelHandle& channel_handle,
156 base::ProcessHandle gpu_process_handle,
156 const GPUInfo& gpu_info) { 157 const GPUInfo& gpu_info) {
157 request->channel_handle = channel_handle; 158 request->channel_handle = channel_handle;
159 request->gpu_process_handle = gpu_process_handle;
158 request->gpu_info = gpu_info; 160 request->gpu_info = gpu_info;
159 request->event.Signal(); 161 request->event.Signal();
160 } 162 }
161 163
162 GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync( 164 GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync(
163 CauseForGpuLaunch cause_for_gpu_launch) { 165 CauseForGpuLaunch cause_for_gpu_launch) {
164 if (gpu_channel_.get()) { 166 if (gpu_channel_.get()) {
165 // Recreate the channel if it has been lost. 167 // Recreate the channel if it has been lost.
166 if (gpu_channel_->state() == GpuChannelHost::kLost) 168 if (gpu_channel_->state() == GpuChannelHost::kLost)
167 gpu_channel_ = NULL; 169 gpu_channel_ = NULL;
(...skipping 14 matching lines...) Expand all
182 // We're blocking the UI thread, which is generally undesirable. 184 // We're blocking the UI thread, which is generally undesirable.
183 // In this case we need to wait for this before we can show any UI /anyway/, 185 // In this case we need to wait for this before we can show any UI /anyway/,
184 // so it won't cause additional jank. 186 // so it won't cause additional jank.
185 // TODO(piman): Make this asynchronous. 187 // TODO(piman): Make this asynchronous.
186 request.event.Wait(); 188 request.event.Wait();
187 189
188 if (request.channel_handle.name.empty() || 190 if (request.channel_handle.name.empty() ||
189 request.gpu_process_handle == base::kNullProcessHandle) 191 request.gpu_process_handle == base::kNullProcessHandle)
190 return NULL; 192 return NULL;
191 193
194 base::ProcessHandle browser_process_for_gpu;
195 #if defined(OS_WIN)
196 // Create a process handle that the GPU process can use to access our handles.
197 DuplicateHandle(base::GetCurrentProcessHandle(),
198 base::GetCurrentProcessHandle(),
199 request.gpu_process_handle,
200 &browser_process_for_gpu,
201 PROCESS_DUP_HANDLE,
202 FALSE,
203 0);
204 #else
205 browser_process_for_gpu = base::GetCurrentProcessHandle();
206 #endif
207
192 gpu_channel_ = new GpuChannelHost(this, gpu_host_id_, gpu_client_id_); 208 gpu_channel_ = new GpuChannelHost(this, gpu_host_id_, gpu_client_id_);
193 gpu_channel_->set_gpu_info(request.gpu_info); 209 gpu_channel_->set_gpu_info(request.gpu_info);
194 content::GetContentClient()->SetGpuInfo(request.gpu_info); 210 content::GetContentClient()->SetGpuInfo(request.gpu_info);
195 211
196 // Connect to the GPU process if a channel name was received. 212 // Connect to the GPU process if a channel name was received.
197 gpu_channel_->Connect(request.channel_handle); 213 gpu_channel_->Connect(request.channel_handle, browser_process_for_gpu);
198 214
199 return gpu_channel_.get(); 215 return gpu_channel_.get();
200 } 216 }
201 217
202 } // namespace content 218 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.h ('k') | content/browser/gpu/gpu_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698