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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_win.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: wip 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 "ui/gl/gl_image.h"
8 #include "ui/gl/gl_image_shared_memory.h"
9
10 namespace content {
11 namespace {
12
13 class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory {
14 public:
15 // Overridden from GpuMemoryBufferFactory:
16 virtual bool CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
17 const gfx::Size& size,
18 unsigned internalformat,
19 unsigned usage) OVERRIDE {
20 NOTREACHED();
21 return false;
22 }
23 virtual void DestroyGpuMemoryBuffer(
24 const gfx::GpuMemoryBufferHandle& handle) OVERRIDE {
25 NOTREACHED();
26 }
27 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
28 const gfx::GpuMemoryBufferHandle& handle,
29 const gfx::Size& size,
30 unsigned internalformat,
31 int client_id) OVERRIDE {
32 switch (handle.type) {
33 case gfx::SHARED_MEMORY_BUFFER: {
34 scoped_refptr<gfx::GLImageSharedMemory> image(
35 new gfx::GLImageSharedMemory(size, internalformat));
36 if (!image->Initialize(handle))
37 return NULL;
38
39 return image;
40 }
41 default:
42 NOTREACHED();
43 return scoped_refptr<gfx::GLImage>();
44 }
45 }
46 };
47
48 } // namespace
49
50 // static
51 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() {
52 return make_scoped_ptr<GpuMemoryBufferFactory>(
53 new GpuMemoryBufferFactoryImpl);
54 }
55
56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698