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

Side by Side Diff: content/browser/compositor/io_surface_layer_mac.h

Issue 558803002: Workaround to prevent crashes when destroying CGL contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use RETAIN Created 6 years, 3 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 | « no previous file | content/browser/compositor/io_surface_layer_mac.mm » ('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 #ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_
6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <IOSurface/IOSurfaceAPI.h> 9 #include <IOSurface/IOSurfaceAPI.h>
10 10
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "ui/gl/scoped_cgl.h"
15 16
16 @class IOSurfaceLayer; 17 @class IOSurfaceLayer;
17 18
18 namespace content { 19 namespace content {
19 class IOSurfaceLayerHelper; 20 class IOSurfaceLayerHelper;
20 21
21 // The interface through which the IOSurfaceLayer calls back into 22 // The interface through which the IOSurfaceLayer calls back into
22 // the structrue that created it (RenderWidgetHostViewMac or 23 // the structrue that created it (RenderWidgetHostViewMac or
23 // BrowserCompositorViewMac). 24 // BrowserCompositorViewMac).
24 class IOSurfaceLayerClient { 25 class IOSurfaceLayerClient {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Set when inside a BeginPumpingFrames/EndPumpingFrames block. 60 // Set when inside a BeginPumpingFrames/EndPumpingFrames block.
60 bool is_pumping_frames_; 61 bool is_pumping_frames_;
61 62
62 // The IOSurface being drawn by this layer. 63 // The IOSurface being drawn by this layer.
63 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; 64 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_;
64 65
65 // The size of the frame in pixels. This will be less or equal than the pixel 66 // The size of the frame in pixels. This will be less or equal than the pixel
66 // size of |io_surface_|. 67 // size of |io_surface_|.
67 gfx::Size frame_pixel_size_; 68 gfx::Size frame_pixel_size_;
68 69
69 // The GL texture that is bound to |io_surface_|. If |io_surface_| changes, 70 // The GL texture that was bound to |io_surface_| during the last draw call,
70 // then this is marked as dirty by setting |io_surface_texture_dirty_|. 71 // along with the context that was done in, and the value of |io_surface_| at
72 // the time of the bind.
71 GLuint io_surface_texture_; 73 GLuint io_surface_texture_;
72 bool io_surface_texture_dirty_; 74 base::ScopedTypeRef<CGLContextObj> io_surface_texture_context_;
75 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_texture_io_surface_;
73 76
74 // The CGL renderer ID, captured at draw time. 77 // The CGL renderer ID, captured at draw time.
75 GLint cgl_renderer_id_; 78 GLint cgl_renderer_id_;
76 } 79 }
77 80
78 - (id)initWithClient:(content::IOSurfaceLayerClient*)client 81 - (id)initWithClient:(content::IOSurfaceLayerClient*)client
79 withScaleFactor:(float)scale_factor; 82 withScaleFactor:(float)scale_factor;
80 83
81 // Called when a new frame is received. 84 // Called when a new frame is received.
82 - (void)gotFrameWithIOSurface:(IOSurfaceID)io_surface_id 85 - (void)gotFrameWithIOSurface:(IOSurfaceID)io_surface_id
(...skipping 13 matching lines...) Expand all
96 // displayed frame). 99 // displayed frame).
97 - (void)setNeedsDisplayAndDisplayAndAck; 100 - (void)setNeedsDisplayAndDisplayAndAck;
98 101
99 // Mark a bracket in which new frames are being pumped in a restricted nested 102 // Mark a bracket in which new frames are being pumped in a restricted nested
100 // run loop. 103 // run loop.
101 - (void)beginPumpingFrames; 104 - (void)beginPumpingFrames;
102 - (void)endPumpingFrames; 105 - (void)endPumpingFrames;
103 @end 106 @end
104 107
105 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ 108 #endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/compositor/io_surface_layer_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698