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

Unified Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 19762004: Add multi-process GpuMemoryBuffer framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | content/common/gpu/client/gpu_memory_buffer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/gpu_channel_host.cc
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index 27c71de98a1b28fbb555b72322237bbd4599a72b..4624ec79c70d830da671d3dd5abdf247bb118e1b 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -46,6 +46,17 @@ scoped_refptr<GpuChannelHost> GpuChannelHost::Create(
return host;
}
+// static
+bool GpuChannelHost::IsValidGpuMemoryBuffer(
+ gfx::GpuMemoryBufferHandle handle) {
+ switch (handle.type) {
+ case gfx::SHARED_MEMORY_BUFFER:
+ return true;
+ default:
+ return false;
+ }
+}
+
GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory,
int gpu_host_id,
int client_id,
@@ -55,6 +66,7 @@ GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory,
gpu_host_id_(gpu_host_id),
gpu_info_(gpu_info) {
next_transfer_buffer_id_.GetNext();
+ next_gpu_memory_buffer_id_.GetNext();
}
void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) {
@@ -285,6 +297,25 @@ int32 GpuChannelHost::ReserveTransferBufferId() {
return next_transfer_buffer_id_.GetNext();
}
+gfx::GpuMemoryBufferHandle GpuChannelHost::ShareGpuMemoryBufferToGpuProcess(
+ gfx::GpuMemoryBufferHandle source_handle) {
+ switch (source_handle.type) {
+ case gfx::SHARED_MEMORY_BUFFER: {
+ gfx::GpuMemoryBufferHandle handle;
+ handle.type = gfx::SHARED_MEMORY_BUFFER;
+ handle.handle = ShareToGpuProcess(source_handle.handle);
+ return handle;
+ }
+ default:
+ NOTREACHED();
+ return gfx::GpuMemoryBufferHandle();
+ }
+}
+
+int32 GpuChannelHost::ReserveGpuMemoryBufferId() {
+ return next_gpu_memory_buffer_id_.GetNext();
+}
+
GpuChannelHost::~GpuChannelHost() {
// channel_ must be destroyed on the main thread.
if (!factory_->IsMainThread())
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | content/common/gpu/client/gpu_memory_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698