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

Side by Side Diff: ui/gl/gl_image_android.cc

Issue 20017005: gpu: Refactor GpuMemoryBuffer framework for multi-process support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gl_image.h" 5 #include "ui/gl/gl_image.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "ui/gl/gl_image_egl.h" 8 #include "ui/gl/gl_image_egl.h"
9 #include "ui/gl/gl_image_shm.h"
9 #include "ui/gl/gl_image_stub.h" 10 #include "ui/gl/gl_image_stub.h"
10 #include "ui/gl/gl_implementation.h" 11 #include "ui/gl/gl_implementation.h"
11 12
12 namespace gfx { 13 namespace gfx {
13 14
14 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) { 15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) {
15 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); 16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage");
16 switch (GetGLImplementation()) { 17 switch (GetGLImplementation()) {
17 case kGLImplementationEGLGLES2: 18 case kGLImplementationEGLGLES2:
18 return NULL; 19 return NULL;
19 case kGLImplementationMockGL: 20 case kGLImplementationMockGL:
20 return new GLImageStub; 21 return new GLImageStub;
21 default: 22 default:
22 NOTREACHED(); 23 NOTREACHED();
23 return NULL; 24 return NULL;
24 } 25 }
25 } 26 }
26 27
27 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( 28 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer(
28 gfx::GpuMemoryBufferHandle buffer, gfx::Size size) { 29 gfx::GpuMemoryBufferHandle buffer, gfx::Size size) {
29 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); 30 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer");
30 switch (GetGLImplementation()) { 31 switch (GetGLImplementation()) {
31 case kGLImplementationEGLGLES2: { 32 case kGLImplementationEGLGLES2:
32 scoped_refptr<GLImageEGL> image(new GLImageEGL(size)); 33 switch (buffer.type) {
33 if (!image->Initialize(buffer)) 34 case SHARED_MEMORY_BUFFER: {
34 return NULL; 35 scoped_refptr<GLImageShm> image(new GLImageShm(size));
36 if (!image->Initialize(buffer))
37 return NULL;
35 38
36 return image; 39 return image;
37 } 40 }
41 case EGL_CLIENT_BUFFER: {
42 scoped_refptr<GLImageEGL> image(new GLImageEGL(size));
43 if (!image->Initialize(buffer))
44 return NULL;
45
46 return image;
47 }
48 default:
49 NOTREACHED();
50 return NULL;
51 }
38 case kGLImplementationMockGL: 52 case kGLImplementationMockGL:
39 return new GLImageStub; 53 return new GLImageStub;
40 default: 54 default:
41 NOTREACHED(); 55 NOTREACHED();
42 return NULL; 56 return NULL;
43 } 57 }
44 } 58 }
45 59
46 } // namespace gfx 60 } // namespace gfx
OLDNEW
« ui/gfx/gpu_memory_buffer.h ('K') | « ui/gl/gl_image.h ('k') | ui/gl/gl_image_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698