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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_android.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/common/gpu/gpu_memory_buffer_factory.h"
6
7 #include "base/logging.h"
8 #include "ui/gl/gl_image.h"
9 #include "ui/gl/gl_image_shared_memory.h"
10 #include "ui/gl/gl_image_surface_texture.h"
11
12 namespace content {
13 namespace {
14
15 class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory {
16 public:
17 // Overridden from GpuMemoryBufferFactory:
18 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
19 const gfx::GpuMemoryBufferHandle& handle,
20 const gfx::Size& size,
21 unsigned internalformat,
22 unsigned usage) OVERRIDE {
23 NOTREACHED();
24 return gfx::GpuMemoryBufferHandle();
25 }
26 virtual void DestroyGpuMemoryBuffer(
27 const gfx::GpuMemoryBufferHandle& handle) OVERRIDE {
28 NOTREACHED();
29 }
30 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
31 const gfx::GpuMemoryBufferHandle& handle,
32 const gfx::Size& size,
33 unsigned internalformat,
34 int client_id) OVERRIDE {
35 switch (handle.type) {
36 case gfx::SHARED_MEMORY_BUFFER: {
37 scoped_refptr<gfx::GLImageSharedMemory> image(
38 new gfx::GLImageSharedMemory(size, internalformat));
39 if (!image->Initialize(handle))
40 return NULL;
41
42 return image;
43 }
44 case gfx::SURFACE_TEXTURE_BUFFER: {
45 scoped_refptr<gfx::GLImageSurfaceTexture> image(
46 new gfx::GLImageSurfaceTexture(size));
47 if (!image->Initialize(handle))
48 return NULL;
49
50 return image;
51 }
52 default:
53 NOTREACHED();
54 return scoped_refptr<gfx::GLImage>();
55 }
56 }
57 };
58
59 } // namespace
60
61 // static
62 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() {
63 return make_scoped_ptr<GpuMemoryBufferFactory>(
64 new GpuMemoryBufferFactoryImpl);
65 }
66
67 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory.h ('k') | content/common/gpu/gpu_memory_buffer_factory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698