| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ACCELERATED_WIDGET_MAC_H_ | 5 #ifndef UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ |
| 6 #define UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ | 6 #define UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ |
| 7 | 7 |
| 8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" | 12 #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h" |
| 13 #include "ui/accelerated_widget_mac/surface_handle_types.h" |
| 13 #include "ui/events/latency_info.h" | 14 #include "ui/events/latency_info.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
| 17 | 18 |
| 18 #if defined(__OBJC__) | 19 #if defined(__OBJC__) |
| 19 #import <Cocoa/Cocoa.h> | 20 #import <Cocoa/Cocoa.h> |
| 20 #import "base/mac/scoped_nsobject.h" | 21 #import "base/mac/scoped_nsobject.h" |
| 21 #include "ui/base/cocoa/remote_layer_api.h" | 22 #include "ui/base/cocoa/remote_layer_api.h" |
| 22 #endif // __OBJC__ | 23 #endif // __OBJC__ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 base::TimeTicks* timebase, base::TimeDelta* interval) const; | 73 base::TimeTicks* timebase, base::TimeDelta* interval) const; |
| 73 | 74 |
| 74 // Return true if the renderer should not be throttled by GPU back-pressure. | 75 // Return true if the renderer should not be throttled by GPU back-pressure. |
| 75 bool IsRendererThrottlingDisabled() const; | 76 bool IsRendererThrottlingDisabled() const; |
| 76 | 77 |
| 77 // Mark a bracket in which new frames are being pumped in a restricted nested | 78 // Mark a bracket in which new frames are being pumped in a restricted nested |
| 78 // run loop. | 79 // run loop. |
| 79 void BeginPumpingFrames(); | 80 void BeginPumpingFrames(); |
| 80 void EndPumpingFrames(); | 81 void EndPumpingFrames(); |
| 81 | 82 |
| 82 void GotAcceleratedFrame( | 83 void GotAcceleratedFrame(CAContextID ca_context_id, |
| 83 uint64 surface_handle, | 84 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 84 const std::vector<ui::LatencyInfo>& latency_info, | 85 const std::vector<ui::LatencyInfo>& latency_info, |
| 85 const gfx::Size& pixel_size, | 86 const gfx::Size& pixel_size, |
| 86 float scale_factor, | 87 float scale_factor, |
| 87 const gfx::Rect& pixel_damage_rect, | 88 const gfx::Rect& pixel_damage_rect, |
| 88 const base::Closure& drawn_callback); | 89 const base::Closure& drawn_callback); |
| 89 | 90 |
| 90 void GotIOSurfaceFrame(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 91 void GotIOSurfaceFrame(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 91 const gfx::Size& pixel_size, | 92 const gfx::Size& pixel_size, |
| 92 float scale_factor, | 93 float scale_factor, |
| 93 bool flip_y); | 94 bool flip_y); |
| 94 | 95 |
| 95 private: | 96 private: |
| 96 void GotAcceleratedCAContextFrame(CAContextID ca_context_id, | 97 void GotAcceleratedCAContextFrame(CAContextID ca_context_id, |
| 97 const gfx::Size& pixel_size, | 98 const gfx::Size& pixel_size, |
| 98 float scale_factor); | 99 float scale_factor); |
| 99 | 100 |
| 100 void GotAcceleratedIOSurfaceFrame(IOSurfaceID io_surface_id, | 101 void GotAcceleratedIOSurfaceFrame( |
| 101 const gfx::Size& pixel_size, | 102 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 102 float scale_factor); | 103 const gfx::Size& pixel_size, |
| 104 float scale_factor); |
| 103 | 105 |
| 104 void AcknowledgeAcceleratedFrame(); | 106 void AcknowledgeAcceleratedFrame(); |
| 105 | 107 |
| 106 // Remove a layer from the heirarchy and destroy it. Because the accelerated | 108 // Remove a layer from the heirarchy and destroy it. Because the accelerated |
| 107 // layer types may be replaced by a layer of the same type, the layer to | 109 // layer types may be replaced by a layer of the same type, the layer to |
| 108 // destroy is parameterized, and, if it is the current layer, the current | 110 // destroy is parameterized, and, if it is the current layer, the current |
| 109 // layer is reset. | 111 // layer is reset. |
| 110 void DestroyCAContextLayer( | 112 void DestroyCAContextLayer( |
| 111 base::scoped_nsobject<CALayerHost> ca_context_layer); | 113 base::scoped_nsobject<CALayerHost> ca_context_layer); |
| 112 void DestroyLocalLayer(); | 114 void DestroyLocalLayer(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // after compositing. | 148 // after compositing. |
| 147 bool needs_gl_finish_workaround_; | 149 bool needs_gl_finish_workaround_; |
| 148 | 150 |
| 149 DISALLOW_COPY_AND_ASSIGN(AcceleratedWidgetMac); | 151 DISALLOW_COPY_AND_ASSIGN(AcceleratedWidgetMac); |
| 150 }; | 152 }; |
| 151 | 153 |
| 152 #endif // __OBJC__ | 154 #endif // __OBJC__ |
| 153 | 155 |
| 154 ACCELERATED_WIDGET_MAC_EXPORT | 156 ACCELERATED_WIDGET_MAC_EXPORT |
| 155 void AcceleratedWidgetMacGotAcceleratedFrame( | 157 void AcceleratedWidgetMacGotAcceleratedFrame( |
| 156 gfx::AcceleratedWidget widget, uint64 surface_handle, | 158 gfx::AcceleratedWidget widget, |
| 159 CAContextID ca_context_id, |
| 160 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 157 const std::vector<ui::LatencyInfo>& latency_info, | 161 const std::vector<ui::LatencyInfo>& latency_info, |
| 158 const gfx::Size& pixel_size, | 162 const gfx::Size& pixel_size, |
| 159 float scale_factor, | 163 float scale_factor, |
| 160 const gfx::Rect& pixel_damage_rect, | 164 const gfx::Rect& pixel_damage_rect, |
| 161 const base::Closure& drawn_callback, | 165 const base::Closure& drawn_callback, |
| 162 bool* disable_throttling, int* renderer_id, | 166 bool* disable_throttling, |
| 163 base::TimeTicks* vsync_timebase, base::TimeDelta* vsync_interval); | 167 int* renderer_id, |
| 168 base::TimeTicks* vsync_timebase, |
| 169 base::TimeDelta* vsync_interval); |
| 164 | 170 |
| 165 ACCELERATED_WIDGET_MAC_EXPORT | 171 ACCELERATED_WIDGET_MAC_EXPORT |
| 166 void AcceleratedWidgetMacGotIOSurfaceFrame( | 172 void AcceleratedWidgetMacGotIOSurfaceFrame( |
| 167 gfx::AcceleratedWidget widget, | 173 gfx::AcceleratedWidget widget, |
| 168 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 174 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 169 const gfx::Size& pixel_size, | 175 const gfx::Size& pixel_size, |
| 170 float scale_factor, | 176 float scale_factor, |
| 171 bool flip_y); | 177 bool flip_y); |
| 172 | 178 |
| 173 } // namespace ui | 179 } // namespace ui |
| 174 | 180 |
| 175 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ | 181 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ |
| OLD | NEW |