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

Unified Diff: content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.cc

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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/gpu_memory_buffer_factory_x11_pixmap.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.cc
diff --git a/content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.cc b/content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.cc
new file mode 100644
index 0000000000000000000000000000000000000000..04f2896fcd4dfc6591d165feb96eee102e5e92bb
--- /dev/null
+++ b/content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.cc
@@ -0,0 +1,53 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h"
+
+#include "ui/gl/gl_image_glx.h"
+
+namespace content {
+
+GpuMemoryBufferFactoryX11Pixmap::GpuMemoryBufferFactoryX11Pixmap() {
+}
+
+GpuMemoryBufferFactoryX11Pixmap::~GpuMemoryBufferFactoryX11Pixmap() {
+}
+
+void GpuMemoryBufferFactoryX11Pixmap::CreateGpuMemoryBuffer(
+ const gfx::GpuMemoryBufferId& id,
+ XID pixmap) {
+ X11PixmapMapKey key(id.primary_id, id.secondary_id);
+ DCHECK(pixmaps_.find(key) == pixmaps_.end());
+ pixmaps_[key] = pixmap;
+}
+
+void GpuMemoryBufferFactoryX11Pixmap::DestroyGpuMemoryBuffer(
+ const gfx::GpuMemoryBufferId& id) {
+ X11PixmapMapKey key(id.primary_id, id.secondary_id);
+ X11PixmapMap::iterator it = pixmaps_.find(key);
+ if (it != pixmaps_.end())
+ pixmaps_.erase(it);
+}
+
+scoped_refptr<gfx::GLImage>
+GpuMemoryBufferFactoryX11Pixmap::AcquireImageForGpuMemoryBuffer(
+ const gfx::GpuMemoryBufferId& id,
+ const gfx::Size& size,
+ unsigned internalformat) {
+ X11PixmapMapKey key(id.primary_id, id.secondary_id);
+ X11PixmapMap::iterator it = pixmaps_.find(key);
+ if (it == pixmaps_.end())
+ return scoped_refptr<gfx::GLImage>();
+ XID pixmap = it->second;
+ pixmaps_.erase(it);
+
+ scoped_refptr<gfx::GLImageGLX> image(
+ new gfx::GLImageGLX(size, internalformat));
+ if (!image->Initialize(pixmap))
+ return scoped_refptr<gfx::GLImage>();
+
+ return image;
+}
+
+} // namespace content
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698