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..3e1891a08316b052a913b7fda043801bcfb55636 100644 |
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc |
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc |
@@ -134,6 +134,69 @@ 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) { |
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |
+ if (!host) { |
+ return; |
+ } |
+ |
+ host->DeleteImage(gpu_client_id_, image_id); |
+} |
+ |
+void BrowserGpuChannelHostFactory::DeleteImage(int32 image_id) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ GetIOLoopProxy()->PostTask(FROM_HERE, base::Bind( |
+ &BrowserGpuChannelHostFactory::DeleteImageOnIO, |
+ base::Unretained(this), |
+ image_id)); |
piman
2012/10/12 22:05:11
Note: there's still a race on destruction. Take th
reveman
2012/10/13 05:25:53
I've added a sync point to DeleteImage. I liked th
|
+} |
+ |
void BrowserGpuChannelHostFactory::EstablishGpuChannelOnIO( |
EstablishRequest* request) { |
GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); |