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 "ui/accelerated_widget_mac/accelerated_widget_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 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Indicate that the recyclable compositor should be destroyed, and no future | 27 // Indicate that the recyclable compositor should be destroyed, and no future |
28 // compositors should be recycled. | 28 // compositors should be recycled. |
29 static void DisableRecyclingForShutdown(); | 29 static void DisableRecyclingForShutdown(); |
30 | 30 |
31 ui::Compositor* compositor() { return &compositor_; } | 31 ui::Compositor* compositor() { return &compositor_; } |
32 ui::AcceleratedWidgetMac* accelerated_widget_mac() { | 32 ui::AcceleratedWidgetMac* accelerated_widget_mac() { |
33 return accelerated_widget_mac_.get(); | 33 return accelerated_widget_mac_.get(); |
34 } | 34 } |
35 | 35 |
| 36 // Suspend will prevent the compositor from producing new frames. This should |
| 37 // be called to avoid creating spurious frames while changing state. |
| 38 // Compositors are created as suspended. |
| 39 void Suspend(); |
| 40 void Unsuspend(); |
| 41 |
36 private: | 42 private: |
37 BrowserCompositorMac(); | 43 BrowserCompositorMac(); |
38 | 44 |
39 scoped_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_; | 45 scoped_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_; |
40 ui::Compositor compositor_; | 46 ui::Compositor compositor_; |
| 47 scoped_refptr<ui::CompositorLock> compositor_suspended_lock_; |
41 | 48 |
42 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMac); | 49 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMac); |
43 }; | 50 }; |
44 | 51 |
45 // A class to keep around whenever a BrowserCompositorMac may be created. | 52 // A class to keep around whenever a BrowserCompositorMac may be created. |
46 // While at least one instance of this class exists, a spare | 53 // While at least one instance of this class exists, a spare |
47 // BrowserCompositorViewCocoa will be kept around to be recycled so that the | 54 // BrowserCompositorViewCocoa will be kept around to be recycled so that the |
48 // next BrowserCompositorMac to be created will be be created quickly. | 55 // next BrowserCompositorMac to be created will be be created quickly. |
49 class BrowserCompositorMacPlaceholder { | 56 class BrowserCompositorMacPlaceholder { |
50 public: | 57 public: |
51 BrowserCompositorMacPlaceholder(); | 58 BrowserCompositorMacPlaceholder(); |
52 ~BrowserCompositorMacPlaceholder(); | 59 ~BrowserCompositorMacPlaceholder(); |
53 | 60 |
54 private: | 61 private: |
55 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMacPlaceholder); | 62 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMacPlaceholder); |
56 }; | 63 }; |
57 | 64 |
58 } // namespace content | 65 } // namespace content |
59 | 66 |
60 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 67 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
OLD | NEW |