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

Side by Side Diff: ui/accelerated_widget_mac/io_surface_ns_gl_surface.h

Issue 1164363005: Mac: Only allow NSOpenGLContext displaying on the main display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_NS_GL_SURFACE_H_ 5 #ifndef UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_NS_GL_SURFACE_H_
6 #define UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_NS_GL_SURFACE_H_ 6 #define UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_NS_GL_SURFACE_H_
7 7
8 #include <Cocoa/Cocoa.h> 8 #include <Cocoa/Cocoa.h>
9 #include <OpenGL/OpenGL.h> 9 #include <OpenGL/OpenGL.h>
10 10
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "ui/accelerated_widget_mac/display_link_mac.h" 13 #include "ui/accelerated_widget_mac/display_link_mac.h"
14 #include "ui/accelerated_widget_mac/io_surface_context.h" 14 #include "ui/accelerated_widget_mac/io_surface_context.h"
15 #include "ui/accelerated_widget_mac/io_surface_texture.h" 15 #include "ui/accelerated_widget_mac/io_surface_texture.h"
16 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
17 17
18 namespace ui { 18 namespace ui {
19 19
20 class IOSurfaceNSGLSurfaceClient { 20 class IOSurfaceNSGLSurfaceClient {
21 public: 21 public:
22 virtual void IOSurfaceNSGLSurfaceDidDrawFrame() = 0; 22 virtual void IOSurfaceNSGLSurfaceDidDrawFrame() = 0;
23 }; 23 };
24 24
25 class IOSurfaceNSGLSurface { 25 class IOSurfaceNSGLSurface {
26 public: 26 public:
27 static IOSurfaceNSGLSurface* Create( 27 static IOSurfaceNSGLSurface* Create(
28 IOSurfaceNSGLSurfaceClient* client, NSView* view); 28 IOSurfaceNSGLSurfaceClient* client,
29 NSView* view,
30 bool needs_gl_finish_workaround);
29 virtual ~IOSurfaceNSGLSurface(); 31 virtual ~IOSurfaceNSGLSurface();
30 32
31 // Called on the UI thread. 33 static bool CanUseNSGLSurfaceForView(NSView* view);
34
32 bool GotFrame(IOSurfaceID io_surface_id, 35 bool GotFrame(IOSurfaceID io_surface_id,
33 gfx::Size pixel_size, 36 gfx::Size pixel_size,
34 float scale_factor, 37 float scale_factor,
35 gfx::Rect pixel_damage_rect); 38 gfx::Rect pixel_damage_rect);
36 39
40 int GetRendererID();
41
37 private: 42 private:
38 explicit IOSurfaceNSGLSurface( 43 explicit IOSurfaceNSGLSurface(
39 IOSurfaceNSGLSurfaceClient* client, 44 IOSurfaceNSGLSurfaceClient* client,
40 NSView* view, 45 NSView* view,
46 bool needs_gl_finish_workaround,
41 base::scoped_nsobject<NSOpenGLContext> ns_gl_context, 47 base::scoped_nsobject<NSOpenGLContext> ns_gl_context,
42 scoped_refptr<ui::IOSurfaceTexture> iosurface); 48 scoped_refptr<ui::IOSurfaceTexture> iosurface);
43 49
44 void DoPendingDrawIfNeeded(); 50 void DoPendingDrawIfNeeded();
45 51
46 IOSurfaceNSGLSurfaceClient* client_; 52 IOSurfaceNSGLSurfaceClient* client_;
47 NSView* view_; 53 NSView* view_;
48 scoped_refptr<IOSurfaceTexture> iosurface_; 54 scoped_refptr<IOSurfaceTexture> iosurface_;
49 base::scoped_nsobject<NSOpenGLContext> ns_gl_context_; 55 base::scoped_nsobject<NSOpenGLContext> ns_gl_context_;
50 56
51 // The size and scale factor of the backbuffer. 57 // The size and scale factor of the backbuffer.
52 gfx::Size contents_pixel_size_; 58 gfx::Size contents_pixel_size_;
53 float contents_scale_factor_; 59 float contents_scale_factor_;
54 60
55 // The state of a draw that has been sent to the surface, but has not been 61 // The state of a draw that has been sent to the surface, but has not been
56 // flushed yet. 62 // flushed yet.
57 bool pending_draw_exists_; 63 bool pending_draw_exists_;
58 gfx::Rect pending_draw_damage_rect_; 64 gfx::Rect pending_draw_damage_rect_;
59 }; 65 };
60 66
61 } // namespace ui 67 } // namespace ui
62 68
63 #endif // UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_NS_GL_SURFACE_H_ 69 #endif // UI_ACCELERATED_WIDGET_MAC_IO_SURFACE_NS_GL_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698