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

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

Issue 10543125: gpu: Add support for GLX_EXT_texture_from_pixmap extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add kGLImplementationMockGL case to gl_image_android.cc. Created 8 years, 2 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 "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "content/browser/gpu/gpu_data_manager_impl.h" 9 #include "content/browser/gpu/gpu_data_manager_impl.h"
10 #include "content/browser/gpu/gpu_process_host.h" 10 #include "content/browser/gpu/gpu_process_host.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 init_params)); 127 init_params));
128 // We're blocking the UI thread, which is generally undesirable. 128 // We're blocking the UI thread, which is generally undesirable.
129 // In this case we need to wait for this before we can show any UI /anyway/, 129 // In this case we need to wait for this before we can show any UI /anyway/,
130 // so it won't cause additional jank. 130 // so it won't cause additional jank.
131 // TODO(piman): Make this asynchronous (http://crbug.com/125248). 131 // TODO(piman): Make this asynchronous (http://crbug.com/125248).
132 base::ThreadRestrictions::ScopedAllowWait allow_wait; 132 base::ThreadRestrictions::ScopedAllowWait allow_wait;
133 request.event.Wait(); 133 request.event.Wait();
134 return request.route_id; 134 return request.route_id;
135 } 135 }
136 136
137 void BrowserGpuChannelHostFactory::CreateImageOnIO(
138 gfx::PluginWindowHandle window,
139 int32 image_id,
140 const CreateImageCallback& callback) {
141 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
142 if (!host) {
143 ImageCreatedOnIO(callback, gfx::Size());
144 return;
145 }
146
147 host->CreateImage(
148 window,
149 gpu_client_id_,
150 image_id,
151 base::Bind(&BrowserGpuChannelHostFactory::ImageCreatedOnIO, callback));
152 }
153
154 // static
155 void BrowserGpuChannelHostFactory::ImageCreatedOnIO(
156 const CreateImageCallback& callback, const gfx::Size size) {
157 BrowserThread::PostTask(
158 BrowserThread::UI,
159 FROM_HERE,
160 base::Bind(&BrowserGpuChannelHostFactory::OnImageCreated,
161 callback, size));
162 }
163
164 // static
165 void BrowserGpuChannelHostFactory::OnImageCreated(
166 const CreateImageCallback& callback, const gfx::Size size) {
167 callback.Run(size);
168 }
169
170 void BrowserGpuChannelHostFactory::CreateImage(
171 gfx::PluginWindowHandle window,
172 int32 image_id,
173 const CreateImageCallback& callback) {
174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
175 GetIOLoopProxy()->PostTask(FROM_HERE, base::Bind(
176 &BrowserGpuChannelHostFactory::CreateImageOnIO,
177 base::Unretained(this),
178 window,
179 image_id,
180 callback));
181 }
182
183 void BrowserGpuChannelHostFactory::DeleteImageOnIO(
184 int32 image_id, int32 sync_point) {
185 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
186 if (!host) {
187 return;
188 }
189
190 host->DeleteImage(gpu_client_id_, image_id, sync_point);
191 }
192
193 void BrowserGpuChannelHostFactory::DeleteImage(
194 int32 image_id, int32 sync_point) {
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
196 GetIOLoopProxy()->PostTask(FROM_HERE, base::Bind(
197 &BrowserGpuChannelHostFactory::DeleteImageOnIO,
198 base::Unretained(this),
199 image_id,
200 sync_point));
201 }
202
137 void BrowserGpuChannelHostFactory::EstablishGpuChannelOnIO( 203 void BrowserGpuChannelHostFactory::EstablishGpuChannelOnIO(
138 EstablishRequest* request) { 204 EstablishRequest* request) {
139 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); 205 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
140 if (!host) { 206 if (!host) {
141 host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 207 host = GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
142 request->cause_for_gpu_launch); 208 request->cause_for_gpu_launch);
143 if (!host) { 209 if (!host) {
144 request->event.Signal(); 210 request->event.Signal();
145 return; 211 return;
146 } 212 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 gpu_channel_->set_gpu_info(request.gpu_info); 284 gpu_channel_->set_gpu_info(request.gpu_info);
219 content::GetContentClient()->SetGpuInfo(request.gpu_info); 285 content::GetContentClient()->SetGpuInfo(request.gpu_info);
220 286
221 // Connect to the GPU process if a channel name was received. 287 // Connect to the GPU process if a channel name was received.
222 gpu_channel_->Connect(request.channel_handle); 288 gpu_channel_->Connect(request.channel_handle);
223 289
224 return gpu_channel_.get(); 290 return gpu_channel_.get();
225 } 291 }
226 292
227 } // namespace content 293 } // 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