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

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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gl/gl_image.h ('k') | ui/gl/gl_image_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_shm.h"
10 #include "ui/gl/gl_image_stub.h" 10 #include "ui/gl/gl_image_stub.h"
11 #include "ui/gl/gl_implementation.h" 11 #include "ui/gl/gl_implementation.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) { 15 scoped_refptr<GLImage> GLImage::CreateGLImage(gfx::PluginWindowHandle window) {
16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage"); 16 TRACE_EVENT0("gpu", "GLImage::CreateGLImage");
17 switch (GetGLImplementation()) { 17 switch (GetGLImplementation()) {
18 case kGLImplementationEGLGLES2: 18 case kGLImplementationEGLGLES2:
19 return NULL; 19 return NULL;
20 case kGLImplementationMockGL: 20 case kGLImplementationMockGL:
21 return new GLImageStub; 21 return new GLImageStub;
22 default: 22 default:
23 NOTREACHED(); 23 NOTREACHED();
24 return NULL; 24 return NULL;
25 } 25 }
26 } 26 }
27 27
28 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer( 28 scoped_refptr<GLImage> GLImage::CreateGLImageForGpuMemoryBuffer(
29 gfx::GpuMemoryBufferHandle buffer, gfx::Size size) { 29 gfx::GpuMemoryBufferHandle buffer,
30 gfx::Size size,
31 unsigned internalformat) {
30 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer"); 32 TRACE_EVENT0("gpu", "GLImage::CreateGLImageForGpuMemoryBuffer");
31 switch (GetGLImplementation()) { 33 switch (GetGLImplementation()) {
32 case kGLImplementationEGLGLES2: 34 case kGLImplementationEGLGLES2:
33 switch (buffer.type) { 35 switch (buffer.type) {
34 case SHARED_MEMORY_BUFFER: { 36 case SHARED_MEMORY_BUFFER: {
35 scoped_refptr<GLImageShm> image(new GLImageShm(size)); 37 scoped_refptr<GLImageShm> image(
38 new GLImageShm(size, internalformat));
36 if (!image->Initialize(buffer)) 39 if (!image->Initialize(buffer))
37 return NULL; 40 return NULL;
38 41
39 return image; 42 return image;
40 } 43 }
41 case EGL_CLIENT_BUFFER: { 44 case EGL_CLIENT_BUFFER: {
42 scoped_refptr<GLImageEGL> image(new GLImageEGL(size)); 45 scoped_refptr<GLImageEGL> image(new GLImageEGL(size));
43 if (!image->Initialize(buffer)) 46 if (!image->Initialize(buffer))
44 return NULL; 47 return NULL;
45 48
46 return image; 49 return image;
47 } 50 }
48 default: 51 default:
49 NOTREACHED(); 52 NOTREACHED();
50 return NULL; 53 return NULL;
51 } 54 }
52 case kGLImplementationMockGL: 55 case kGLImplementationMockGL:
53 return new GLImageStub; 56 return new GLImageStub;
54 default: 57 default:
55 NOTREACHED(); 58 NOTREACHED();
56 return NULL; 59 return NULL;
57 } 60 }
58 } 61 }
59 62
60 } // namespace gfx 63 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_image.h ('k') | ui/gl/gl_image_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698