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_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
7 | 7 |
8 #include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" | 8 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 // A ui::Compositor and a gfx::AcceleratedWidget (and helper) that it draws | 13 // A ui::Compositor and a gfx::AcceleratedWidget (and helper) that it draws |
14 // into. This structure is used to efficiently recycle these structures across | 14 // into. This structure is used to efficiently recycle these structures across |
15 // tabs (because creating a new ui::Compositor for each tab would be expensive | 15 // tabs (because creating a new ui::Compositor for each tab would be expensive |
16 // in terms of time and resources). | 16 // in terms of time and resources). |
17 class BrowserCompositorMac { | 17 class BrowserCompositorMac { |
18 public: | 18 public: |
19 // Create a compositor, or recycle a preexisting one. | 19 // Create a compositor, or recycle a preexisting one. |
20 static scoped_ptr<BrowserCompositorMac> Create(); | 20 static scoped_ptr<BrowserCompositorMac> Create(); |
21 | 21 |
22 // Delete a compositor, or allow it to be recycled. | 22 // Delete a compositor, or allow it to be recycled. |
23 static void Recycle(scoped_ptr<BrowserCompositorMac> compositor); | 23 static void Recycle(scoped_ptr<BrowserCompositorMac> compositor); |
24 | 24 |
25 ui::Compositor* compositor() { return &compositor_; } | 25 ui::Compositor* compositor() { return &compositor_; } |
26 AcceleratedWidgetMac* accelerated_widget_mac() { | 26 ui::AcceleratedWidgetMac* accelerated_widget_mac() { |
27 return &accelerated_widget_mac_; | 27 return &accelerated_widget_mac_; |
28 } | 28 } |
29 | 29 |
30 private: | 30 private: |
31 BrowserCompositorMac(); | 31 BrowserCompositorMac(); |
32 | 32 |
33 AcceleratedWidgetMac accelerated_widget_mac_; | 33 ui::AcceleratedWidgetMac accelerated_widget_mac_; |
34 ui::Compositor compositor_; | 34 ui::Compositor compositor_; |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMac); | 36 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMac); |
37 }; | 37 }; |
38 | 38 |
39 // A class to keep around whenever a BrowserCompositorMac may be created. | 39 // A class to keep around whenever a BrowserCompositorMac may be created. |
40 // While at least one instance of this class exists, a spare | 40 // While at least one instance of this class exists, a spare |
41 // BrowserCompositorViewCocoa will be kept around to be recycled so that the | 41 // BrowserCompositorViewCocoa will be kept around to be recycled so that the |
42 // next BrowserCompositorMac to be created will be be created quickly. | 42 // next BrowserCompositorMac to be created will be be created quickly. |
43 class BrowserCompositorMacPlaceholder { | 43 class BrowserCompositorMacPlaceholder { |
44 public: | 44 public: |
45 BrowserCompositorMacPlaceholder(); | 45 BrowserCompositorMacPlaceholder(); |
46 ~BrowserCompositorMacPlaceholder(); | 46 ~BrowserCompositorMacPlaceholder(); |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMacPlaceholder); | 49 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMacPlaceholder); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace content | 52 } // namespace content |
53 | 53 |
54 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 54 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
OLD | NEW |