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

Unified 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: Add GPU switch 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 side-by-side diff with in-line comments
Download patch
Index: ui/accelerated_widget_mac/io_surface_ns_gl_surface.h
diff --git a/ui/accelerated_widget_mac/io_surface_ns_gl_surface.h b/ui/accelerated_widget_mac/io_surface_ns_gl_surface.h
index f18952b2d8088ddce0f77f8861f6e6c2216b02bf..cb373ca318202386cfb07e8bf4965db147a797e0 100644
--- a/ui/accelerated_widget_mac/io_surface_ns_gl_surface.h
+++ b/ui/accelerated_widget_mac/io_surface_ns_gl_surface.h
@@ -14,6 +14,7 @@
#include "ui/accelerated_widget_mac/io_surface_context.h"
#include "ui/accelerated_widget_mac/io_surface_texture.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gl/gpu_switching_observer.h"
namespace ui {
@@ -22,22 +23,33 @@ class IOSurfaceNSGLSurfaceClient {
virtual void IOSurfaceNSGLSurfaceDidDrawFrame() = 0;
};
-class IOSurfaceNSGLSurface {
+class IOSurfaceNSGLSurface : public ui::GpuSwitchingObserver {
public:
static IOSurfaceNSGLSurface* Create(
- IOSurfaceNSGLSurfaceClient* client, NSView* view);
+ IOSurfaceNSGLSurfaceClient* client,
+ NSView* view,
+ bool needs_gl_finish_workaround);
virtual ~IOSurfaceNSGLSurface();
- // Called on the UI thread.
+ static bool CanUseNSGLSurfaceForView(NSView* view);
+
bool GotFrame(IOSurfaceID io_surface_id,
gfx::Size pixel_size,
float scale_factor,
gfx::Rect pixel_damage_rect);
+ int GetRendererID();
+
+ bool NeedsToBeRecreated() const { return needs_to_be_recreated_; }
+
+ // ui::GpuSwitchingObserver implementation.
+ void OnGpuSwitched() override;
+
private:
explicit IOSurfaceNSGLSurface(
IOSurfaceNSGLSurfaceClient* client,
NSView* view,
+ bool needs_gl_finish_workaround,
base::scoped_nsobject<NSOpenGLContext> ns_gl_context,
scoped_refptr<ui::IOSurfaceTexture> iosurface);
@@ -56,6 +68,10 @@ class IOSurfaceNSGLSurface {
// flushed yet.
bool pending_draw_exists_;
gfx::Rect pending_draw_damage_rect_;
+
+ // If the context has hit an error or has changed GPUs, then this will be
+ // set to true.
+ bool needs_to_be_recreated_;
};
} // namespace ui
« no previous file with comments | « ui/accelerated_widget_mac/io_surface_layer.mm ('k') | ui/accelerated_widget_mac/io_surface_ns_gl_surface.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698