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

Unified Diff: gpu/command_buffer/service/image_manager.cc

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 | « gpu/command_buffer/service/image_manager.h ('k') | gpu/command_buffer/service/in_process_command_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/image_manager.cc
diff --git a/gpu/command_buffer/service/image_manager.cc b/gpu/command_buffer/service/image_manager.cc
index 6be4e6677215830c704754e43ad182ad590632e1..a09af1586b0b9baf0e9266a9e292f8d38502d582 100644
--- a/gpu/command_buffer/service/image_manager.cc
+++ b/gpu/command_buffer/service/image_manager.cc
@@ -15,6 +15,36 @@ ImageManager::ImageManager() {
ImageManager::~ImageManager() {
}
+bool ImageManager::RegisterGpuMemoryBuffer(int32 id,
+ gfx::GpuMemoryBufferHandle buffer,
+ size_t width,
+ size_t height,
+ unsigned internalformat) {
+ if (id <= 0) {
+ DVLOG(0) << "Cannot register GPU memory buffer with non-positive ID.";
+ return false;
+ }
+
+ if (LookupImage(id)) {
+ DVLOG(0) << "GPU memory buffer ID already in use.";
+ return false;
+ }
+
+ scoped_refptr<gfx::GLImage> gl_image =
+ gfx::GLImage::CreateGLImageForGpuMemoryBuffer(buffer,
+ gfx::Size(width, height),
+ internalformat);
+ if (!gl_image)
+ return false;
+
+ AddImage(gl_image.get(), id);
+ return true;
+}
+
+void ImageManager::DestroyGpuMemoryBuffer(int32 id) {
+ RemoveImage(id);
+}
+
void ImageManager::AddImage(gfx::GLImage* image, int32 service_id) {
gl_images_[service_id] = image;
}
« no previous file with comments | « gpu/command_buffer/service/image_manager.h ('k') | gpu/command_buffer/service/in_process_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698