| 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 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void ResetNSView(); | 60 void ResetNSView(); |
| 61 | 61 |
| 62 // Return true if the last frame swapped has a size in DIP of |dip_size|. | 62 // Return true if the last frame swapped has a size in DIP of |dip_size|. |
| 63 bool HasFrameOfSize(const gfx::Size& dip_size) const; | 63 bool HasFrameOfSize(const gfx::Size& dip_size) const; |
| 64 | 64 |
| 65 // Populate the vsync parameters for the surface's display. | 65 // Populate the vsync parameters for the surface's display. |
| 66 void GetVSyncParameters( | 66 void GetVSyncParameters( |
| 67 base::TimeTicks* timebase, base::TimeDelta* interval) const; | 67 base::TimeTicks* timebase, base::TimeDelta* interval) const; |
| 68 | 68 |
| 69 void GotFrame(CAContextID ca_context_id, | 69 void GotFrame(CAContextID ca_context_id, |
| 70 bool fullscreen_low_power_ca_context_valid, |
| 71 CAContextID fullscreen_low_power_ca_context_id, |
| 70 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 72 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 71 const gfx::Size& pixel_size, | 73 const gfx::Size& pixel_size, |
| 72 float scale_factor); | 74 float scale_factor); |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 void GotCAContextFrame(CAContextID ca_context_id, | 77 void GotCAContextFrame(CAContextID ca_context_id, |
| 78 bool fullscreen_low_power_ca_context_valid, |
| 79 CAContextID fullscreen_low_power_ca_context_id, |
| 76 const gfx::Size& pixel_size, | 80 const gfx::Size& pixel_size, |
| 77 float scale_factor); | 81 float scale_factor); |
| 78 | 82 |
| 79 void GotIOSurfaceFrame(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 83 void GotIOSurfaceFrame(base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 80 const gfx::Size& pixel_size, | 84 const gfx::Size& pixel_size, |
| 81 float scale_factor); | 85 float scale_factor); |
| 82 | 86 |
| 83 // Remove a layer from the heirarchy and destroy it. Because the accelerated | 87 // Remove a layer from the heirarchy and destroy it. Because the accelerated |
| 84 // layer types may be replaced by a layer of the same type, the layer to | 88 // layer types may be replaced by a layer of the same type, the layer to |
| 85 // destroy is parameterized, and, if it is the current layer, the current | 89 // destroy is parameterized, and, if it is the current layer, the current |
| (...skipping 11 matching lines...) Expand all Loading... |
| 97 | 101 |
| 98 // A flipped layer, which acts as the parent of the compositing and software | 102 // A flipped layer, which acts as the parent of the compositing and software |
| 99 // layers. This layer is flipped so that the we don't need to recompute the | 103 // layers. This layer is flipped so that the we don't need to recompute the |
| 100 // origin for sub-layers when their position changes (this is impossible when | 104 // origin for sub-layers when their position changes (this is impossible when |
| 101 // using remote layers, as their size change cannot be synchronized with the | 105 // using remote layers, as their size change cannot be synchronized with the |
| 102 // window). This indirection is needed because flipping hosted layers (like | 106 // window). This indirection is needed because flipping hosted layers (like |
| 103 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable | 107 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable |
| 104 // behavior. | 108 // behavior. |
| 105 base::scoped_nsobject<CALayer> flipped_layer_; | 109 base::scoped_nsobject<CALayer> flipped_layer_; |
| 106 | 110 |
| 107 // The accelerated CoreAnimation layer hosted by the GPU process. | 111 // The accelerated CoreAnimation layers hosted by the GPU process. |
| 108 base::scoped_nsobject<CALayerHost> ca_context_layer_; | 112 base::scoped_nsobject<CALayerHost> ca_context_layer_; |
| 113 base::scoped_nsobject<CALayerHost> fullscreen_low_power_layer_; |
| 109 | 114 |
| 110 // The locally drawn layer, which has its contents set to an IOSurface. | 115 // The locally drawn layer, which has its contents set to an IOSurface. |
| 111 base::scoped_nsobject<CALayer> local_layer_; | 116 base::scoped_nsobject<CALayer> local_layer_; |
| 112 | 117 |
| 113 // The size in DIP of the last swap received from |compositor_|. | 118 // The size in DIP of the last swap received from |compositor_|. |
| 114 gfx::Size last_swap_size_dip_; | 119 gfx::Size last_swap_size_dip_; |
| 115 | 120 |
| 116 DISALLOW_COPY_AND_ASSIGN(AcceleratedWidgetMac); | 121 DISALLOW_COPY_AND_ASSIGN(AcceleratedWidgetMac); |
| 117 }; | 122 }; |
| 118 | 123 |
| 119 #endif // __OBJC__ | 124 #endif // __OBJC__ |
| 120 | 125 |
| 121 ACCELERATED_WIDGET_MAC_EXPORT | 126 ACCELERATED_WIDGET_MAC_EXPORT |
| 122 void AcceleratedWidgetMacGotFrame( | 127 void AcceleratedWidgetMacGotFrame( |
| 123 gfx::AcceleratedWidget widget, | 128 gfx::AcceleratedWidget widget, |
| 124 CAContextID ca_context_id, | 129 CAContextID ca_context_id, |
| 130 bool fullscreen_low_power_ca_context_valid, |
| 131 CAContextID fullscreen_low_power_ca_context_id, |
| 125 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 132 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 126 const gfx::Size& pixel_size, | 133 const gfx::Size& pixel_size, |
| 127 float scale_factor, | 134 float scale_factor, |
| 128 base::TimeTicks* vsync_timebase, | 135 base::TimeTicks* vsync_timebase, |
| 129 base::TimeDelta* vsync_interval); | 136 base::TimeDelta* vsync_interval); |
| 130 | 137 |
| 131 } // namespace ui | 138 } // namespace ui |
| 132 | 139 |
| 133 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ | 140 #endif // UI_ACCELERATED_WIDGET_MAC_ACCELERATED_WIDGET_MAC_H_ |
| OLD | NEW |