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

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 1129943006: Implement StreamTexture::BindTexImage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CreateStreamTexture Flow Change. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
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 3de76c0b298191048f40635bbb47f63167028bab..ae49d33a9760bb1179dc18baf122b18cbb02431a 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -32,7 +32,6 @@ BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL;
struct BrowserGpuChannelHostFactory::CreateRequest {
CreateRequest(int32 route_id)
: event(true, false),
- gpu_host_id(0),
route_id(route_id),
result(CREATE_COMMAND_BUFFER_FAILED) {}
~CreateRequest() {}
@@ -42,6 +41,20 @@ struct BrowserGpuChannelHostFactory::CreateRequest {
CreateCommandBufferResult result;
};
+struct BrowserGpuChannelHostFactory::CreateStreamTextureRequest {
+ CreateStreamTextureRequest(int32 image_id, int32 stream_id, int32 route_id)
+ : event(true, false),
+ image_id(image_id),
+ stream_id(stream_id),
+ route_id(route_id) {}
+ ~CreateStreamTextureRequest() {}
+ base::WaitableEvent event;
+ int32 image_id;
+ int32 stream_id;
+ int32 route_id;
+ bool result;
+};
+
class BrowserGpuChannelHostFactory::EstablishRequest
: public base::RefCountedThreadSafe<EstablishRequest> {
public:
@@ -284,6 +297,19 @@ void BrowserGpuChannelHostFactory::CreateViewCommandBufferOnIO(
request));
}
+void BrowserGpuChannelHostFactory::CreateStreamTextureOnIO(
+ CreateStreamTextureRequest* request) {
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
+ if (!host) {
+ request->event.Signal();
+ return;
+ }
+ host->CreateStreamTexture(
+ request->image_id, gpu_client_id_, request->route_id, request->stream_id,
+ base::Bind(&BrowserGpuChannelHostFactory::StreamTextureCreatedOnIO,
+ request));
+}
+
IPC::AttachmentBroker* BrowserGpuChannelHostFactory::GetAttachmentBroker() {
return content::ChildProcessHost::GetAttachmentBroker();
}
@@ -295,6 +321,14 @@ void BrowserGpuChannelHostFactory::CommandBufferCreatedOnIO(
request->event.Signal();
}
+// static
+void BrowserGpuChannelHostFactory::StreamTextureCreatedOnIO(
+ CreateStreamTextureRequest* request,
+ bool result) {
+ request->result = result;
+ request->event.Signal();
+}
+
CreateCommandBufferResult BrowserGpuChannelHostFactory::CreateViewCommandBuffer(
int32 surface_id,
const GPUCreateCommandBufferConfig& init_params,
@@ -320,6 +354,23 @@ CreateCommandBufferResult BrowserGpuChannelHostFactory::CreateViewCommandBuffer(
return request.result;
}
+bool BrowserGpuChannelHostFactory::CreateStreamTexture(int32 image_id,
+ int32 route_id,
+ int32 stream_id) {
+ CreateStreamTextureRequest request(image_id, stream_id, route_id);
+
+ GetIOThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&BrowserGpuChannelHostFactory::CreateStreamTextureOnIO,
+ base::Unretained(this), &request));
+ TRACE_EVENT0("browser",
+ "BrowserGpuChannelHostFactory::CreateStreamTextureOnIO");
+
+ base::ThreadRestrictions::ScopedAllowWait allow_wait;
+ request.event.Wait();
+ return request.result;
+}
+
// Blocking the UI thread to open a GPU channel is not supported on Android.
// (Opening the initial channel to a child process involves handling a reply
// task on the UI thread first, so we cannot block here.)

Powered by Google App Engine
This is Rietveld 408576698