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

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

Issue 1050923003: zero-copy: Clarify to allocate/destroy GpuMemoryBuffer on any thread and use it on the main thread o (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rephrase comment in gpu_channel_manager.cc Created 5 years, 8 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
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_surface_texture.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_io_surface.h" 5 #include "ui/gl/gl_image_io_surface.h"
6 6
7 #include "ui/gl/gl_bindings.h" 7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_context.h" 8 #include "ui/gl/gl_context.h"
9 9
10 // Note that this must be included after gl_bindings.h to avoid conflicts. 10 // Note that this must be included after gl_bindings.h to avoid conflicts.
11 #include <OpenGL/CGLIOSurface.h> 11 #include <OpenGL/CGLIOSurface.h>
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 GLImageIOSurface::GLImageIOSurface(const gfx::Size& size) : size_(size) { 15 GLImageIOSurface::GLImageIOSurface(const gfx::Size& size) : size_(size) {
16 } 16 }
17 17
18 GLImageIOSurface::~GLImageIOSurface() { 18 GLImageIOSurface::~GLImageIOSurface() {
19 DCHECK(thread_checker_.CalledOnValidThread());
19 DCHECK(!io_surface_); 20 DCHECK(!io_surface_);
20 } 21 }
21 22
22 bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface) { 23 bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface) {
24 DCHECK(thread_checker_.CalledOnValidThread());
23 DCHECK(!io_surface_); 25 DCHECK(!io_surface_);
24 io_surface_.reset(io_surface); 26 io_surface_.reset(io_surface);
25 return true; 27 return true;
26 } 28 }
27 29
28 void GLImageIOSurface::Destroy(bool have_context) { 30 void GLImageIOSurface::Destroy(bool have_context) {
31 DCHECK(thread_checker_.CalledOnValidThread());
29 io_surface_.reset(); 32 io_surface_.reset();
30 } 33 }
31 34
32 gfx::Size GLImageIOSurface::GetSize() { return size_; } 35 gfx::Size GLImageIOSurface::GetSize() { return size_; }
33 36
34 bool GLImageIOSurface::BindTexImage(unsigned target) { 37 bool GLImageIOSurface::BindTexImage(unsigned target) {
38 DCHECK(thread_checker_.CalledOnValidThread());
35 if (target != GL_TEXTURE_RECTANGLE_ARB) { 39 if (target != GL_TEXTURE_RECTANGLE_ARB) {
36 // This might be supported in the future. For now, perform strict 40 // This might be supported in the future. For now, perform strict
37 // validation so we know what's going on. 41 // validation so we know what's going on.
38 LOG(ERROR) << "IOSurface requires TEXTURE_RECTANGLE_ARB target"; 42 LOG(ERROR) << "IOSurface requires TEXTURE_RECTANGLE_ARB target";
39 return false; 43 return false;
40 } 44 }
41 45
42 CGLContextObj cgl_context = 46 CGLContextObj cgl_context =
43 static_cast<CGLContextObj>(GLContext::GetCurrent()->GetHandle()); 47 static_cast<CGLContextObj>(GLContext::GetCurrent()->GetHandle());
44 48
(...skipping 21 matching lines...) Expand all
66 70
67 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 71 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
68 int z_order, 72 int z_order,
69 OverlayTransform transform, 73 OverlayTransform transform,
70 const Rect& bounds_rect, 74 const Rect& bounds_rect,
71 const RectF& crop_rect) { 75 const RectF& crop_rect) {
72 return false; 76 return false;
73 } 77 }
74 78
75 } // namespace gfx 79 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_surface_texture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698