Index: content/browser/gpu/browser_gpu_channel_host_factory.cc |
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc |
index 11d7287aa4604c817a9b8ac0ac56d26d1d5c9611..49717b4980dd9e8863db48455ab179fd584231f3 100644 |
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc |
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc |
@@ -134,6 +134,72 @@ int32 BrowserGpuChannelHostFactory::CreateViewCommandBuffer( |
return request.route_id; |
} |
+void BrowserGpuChannelHostFactory::CreateImageOnIO( |
+ gfx::PluginWindowHandle window, |
+ int32 image_id, |
+ const CreateImageCallback& callback) { |
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |
+ if (!host) { |
+ ImageCreatedOnIO(callback, gfx::Size()); |
+ return; |
+ } |
+ |
+ host->CreateImage( |
+ window, |
+ gpu_client_id_, |
+ image_id, |
+ base::Bind(&BrowserGpuChannelHostFactory::ImageCreatedOnIO, callback)); |
+} |
+ |
+// static |
+void BrowserGpuChannelHostFactory::ImageCreatedOnIO( |
+ const CreateImageCallback& callback, const gfx::Size size) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&BrowserGpuChannelHostFactory::OnImageCreated, |
+ callback, size)); |
+} |
+ |
+// static |
+void BrowserGpuChannelHostFactory::OnImageCreated( |
+ const CreateImageCallback& callback, const gfx::Size size) { |
+ callback.Run(size); |
+} |
+ |
+void BrowserGpuChannelHostFactory::CreateImage( |
+ gfx::PluginWindowHandle window, |
+ int32 image_id, |
+ const CreateImageCallback& callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ GetIOLoopProxy()->PostTask(FROM_HERE, base::Bind( |
+ &BrowserGpuChannelHostFactory::CreateImageOnIO, |
+ base::Unretained(this), |
+ window, |
+ image_id, |
+ callback)); |
+} |
+ |
+void BrowserGpuChannelHostFactory::DeleteImageOnIO( |
+ int32 image_id, int32 sync_point) { |
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |
+ if (!host) { |
+ return; |
+ } |
+ |
+ host->DeleteImage(gpu_client_id_, image_id, sync_point); |
+} |
+ |
+void BrowserGpuChannelHostFactory::DeleteImage( |
+ int32 image_id, int32 sync_point) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ GetIOLoopProxy()->PostTask(FROM_HERE, base::Bind( |
+ &BrowserGpuChannelHostFactory::DeleteImageOnIO, |
+ base::Unretained(this), |
+ image_id, |
+ sync_point)); |
+} |
+ |
void BrowserGpuChannelHostFactory::EstablishGpuChannelOnIO( |
EstablishRequest* request) { |
GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |