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 CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ |
7 | 7 |
8 #include "content/browser/compositor/browser_compositor_view_mac.h" | 8 #include "content/browser/compositor/browser_compositor_view_mac.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 class BrowserCompositorViewCocoaHelper; | 11 class BrowserCompositorViewCocoaHelper; |
12 } | 12 } |
13 | 13 |
14 // An NSView drawn by a ui::Compositor. This structure is expensive to create, | 14 // An NSView drawn by a ui::Compositor. This structure is expensive to create, |
15 // because it has a ui::Compositor. As a result, this structure may be recycled | 15 // because it has a ui::Compositor. As a result, this structure may be recycled |
16 // across multiple BrowserCompositorViewMac objects. | 16 // across multiple BrowserCompositorViewMac objects. |
17 @interface BrowserCompositorViewCocoa : NSView { | 17 @interface BrowserCompositorViewCocoa : NSView { |
18 scoped_ptr<ui::Compositor> compositor_; | 18 scoped_ptr<ui::Compositor> compositor_; |
19 | 19 |
20 base::scoped_nsobject<CALayer> background_layer_; | 20 // A flipped layer, which acts as the parent of the compositing and software |
| 21 // layers. This layer is flipped so that the we don't need to recompute the |
| 22 // origin for sub-layers when their position changes (this is impossible when |
| 23 // using remote layers, as their size change cannot be synchronized with the |
| 24 // window). This indirection is needed because flipping hosted layers (like |
| 25 // |background_layer_| of RenderWidgetHostViewCocoa) leads to unpredictable |
| 26 // behavior. |
| 27 base::scoped_nsobject<CALayer> flipped_layer_; |
| 28 |
21 base::scoped_nsobject<CompositingIOSurfaceLayer> accelerated_layer_; | 29 base::scoped_nsobject<CompositingIOSurfaceLayer> accelerated_layer_; |
22 int accelerated_layer_output_surface_id_; | 30 int accelerated_layer_output_surface_id_; |
23 std::vector<ui::LatencyInfo> accelerated_latency_info_; | 31 std::vector<ui::LatencyInfo> accelerated_latency_info_; |
| 32 |
24 base::scoped_nsobject<SoftwareLayer> software_layer_; | 33 base::scoped_nsobject<SoftwareLayer> software_layer_; |
25 | 34 |
26 content::BrowserCompositorViewMacClient* client_; | 35 content::BrowserCompositorViewMacClient* client_; |
27 scoped_ptr<content::BrowserCompositorViewCocoaHelper> helper_; | 36 scoped_ptr<content::BrowserCompositorViewCocoaHelper> helper_; |
28 } | 37 } |
29 | 38 |
30 // Change the client and superview of the view. If this is set to NULL then | 39 // Change the client and superview of the view. If this is set to NULL then |
31 // the compositor will be prepared to be recycled. | 40 // the compositor will be prepared to be recycled. |
32 - (void)setClient:(content::BrowserCompositorViewMacClient*)client; | 41 - (void)setClient:(content::BrowserCompositorViewMacClient*)client; |
33 | 42 |
(...skipping 26 matching lines...) Expand all Loading... |
60 private: | 69 private: |
61 // CompositingIOSurfaceLayerClient implementation: | 70 // CompositingIOSurfaceLayerClient implementation: |
62 virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE; | 71 virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE; |
63 | 72 |
64 BrowserCompositorViewCocoa* view_; | 73 BrowserCompositorViewCocoa* view_; |
65 }; | 74 }; |
66 | 75 |
67 } // namespace content | 76 } // namespace content |
68 | 77 |
69 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ | 78 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ |
OLD | NEW |