OLD | NEW |
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 "content/browser/renderer_host/compositing_iosurface_mac.h" | 5 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
6 | 6 |
7 #include <OpenGL/CGLIOSurface.h> | 7 #include <OpenGL/CGLIOSurface.h> |
8 #include <OpenGL/CGLRenderers.h> | 8 #include <OpenGL/CGLRenderers.h> |
9 #include <OpenGL/OpenGL.h> | 9 #include <OpenGL/OpenGL.h> |
10 #include <OpenGL/gl.h> | 10 #include <OpenGL/gl.h> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } while (0) | 43 } while (0) |
44 #endif | 44 #endif |
45 | 45 |
46 namespace content { | 46 namespace content { |
47 | 47 |
48 // static | 48 // static |
49 scoped_refptr<CompositingIOSurfaceMac> CompositingIOSurfaceMac::Create() { | 49 scoped_refptr<CompositingIOSurfaceMac> CompositingIOSurfaceMac::Create() { |
50 scoped_refptr<CompositingIOSurfaceContext> offscreen_context = | 50 scoped_refptr<CompositingIOSurfaceContext> offscreen_context = |
51 CompositingIOSurfaceContext::Get( | 51 CompositingIOSurfaceContext::Get( |
52 CompositingIOSurfaceContext::kOffscreenContextWindowNumber); | 52 CompositingIOSurfaceContext::kOffscreenContextWindowNumber); |
53 if (!offscreen_context) { | 53 if (!offscreen_context.get()) { |
54 LOG(ERROR) << "Failed to create context for offscreen operations"; | 54 LOG(ERROR) << "Failed to create context for offscreen operations"; |
55 return NULL; | 55 return NULL; |
56 } | 56 } |
57 | 57 |
58 return new CompositingIOSurfaceMac(offscreen_context); | 58 return new CompositingIOSurfaceMac(offscreen_context); |
59 } | 59 } |
60 | 60 |
61 CompositingIOSurfaceMac::CompositingIOSurfaceMac( | 61 CompositingIOSurfaceMac::CompositingIOSurfaceMac( |
62 const scoped_refptr<CompositingIOSurfaceContext>& offscreen_context) | 62 const scoped_refptr<CompositingIOSurfaceContext>& offscreen_context) |
63 : offscreen_context_(offscreen_context), | 63 : offscreen_context_(offscreen_context), |
64 io_surface_handle_(0), | 64 io_surface_handle_(0), |
65 scale_factor_(1.f), | 65 scale_factor_(1.f), |
66 texture_(0), | 66 texture_(0), |
67 gl_error_(GL_NO_ERROR), | 67 gl_error_(GL_NO_ERROR), |
68 eviction_queue_iterator_(eviction_queue_.Get().end()), | 68 eviction_queue_iterator_(eviction_queue_.Get().end()), |
69 eviction_has_been_drawn_since_updated_(false) { | 69 eviction_has_been_drawn_since_updated_(false) { |
70 CHECK(offscreen_context_); | 70 CHECK(offscreen_context_.get()); |
71 } | 71 } |
72 | 72 |
73 CompositingIOSurfaceMac::~CompositingIOSurfaceMac() { | 73 CompositingIOSurfaceMac::~CompositingIOSurfaceMac() { |
74 { | 74 { |
75 gfx::ScopedCGLSetCurrentContext scoped_set_current_context( | 75 gfx::ScopedCGLSetCurrentContext scoped_set_current_context( |
76 offscreen_context_->cgl_context()); | 76 offscreen_context_->cgl_context()); |
77 UnrefIOSurfaceWithContextCurrent(); | 77 UnrefIOSurfaceWithContextCurrent(); |
78 } | 78 } |
79 offscreen_context_ = NULL; | 79 offscreen_context_ = NULL; |
80 DCHECK(eviction_queue_iterator_ == eviction_queue_.Get().end()); | 80 DCHECK(eviction_queue_iterator_ == eviction_queue_.Get().end()); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 368 } |
369 | 369 |
370 // static | 370 // static |
371 base::LazyInstance<CompositingIOSurfaceMac::EvictionQueue> | 371 base::LazyInstance<CompositingIOSurfaceMac::EvictionQueue> |
372 CompositingIOSurfaceMac::eviction_queue_; | 372 CompositingIOSurfaceMac::eviction_queue_; |
373 | 373 |
374 // static | 374 // static |
375 bool CompositingIOSurfaceMac::eviction_scheduled_ = false; | 375 bool CompositingIOSurfaceMac::eviction_scheduled_ = false; |
376 | 376 |
377 } // namespace content | 377 } // namespace content |
OLD | NEW |