Change next_proto member type.
[chromium-blink-merge.git] / content / browser / compositor / browser_compositor_view_mac.h
blob91e49e32aa0a88ed98e0c2eab89e974a9fb2e0bf
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
8 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
9 #include "ui/compositor/compositor.h"
11 namespace content {
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
15 // tabs (because creating a new ui::Compositor for each tab would be expensive
16 // in terms of time and resources).
17 class BrowserCompositorMac {
18 public:
19 ~BrowserCompositorMac();
21 // Create a compositor, or recycle a preexisting one.
22 static scoped_ptr<BrowserCompositorMac> Create();
24 // Delete a compositor, or allow it to be recycled.
25 static void Recycle(scoped_ptr<BrowserCompositorMac> compositor);
27 // Indicate that the recyclable compositor should be destroyed, and no future
28 // compositors should be recycled.
29 static void DisableRecyclingForShutdown();
31 ui::Compositor* compositor() { return &compositor_; }
32 ui::AcceleratedWidgetMac* accelerated_widget_mac() {
33 return accelerated_widget_mac_.get();
36 private:
37 BrowserCompositorMac();
39 scoped_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_;
40 ui::Compositor compositor_;
42 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMac);
45 // A class to keep around whenever a BrowserCompositorMac may be created.
46 // While at least one instance of this class exists, a spare
47 // BrowserCompositorViewCocoa will be kept around to be recycled so that the
48 // next BrowserCompositorMac to be created will be be created quickly.
49 class BrowserCompositorMacPlaceholder {
50 public:
51 BrowserCompositorMacPlaceholder();
52 ~BrowserCompositorMacPlaceholder();
54 private:
55 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMacPlaceholder);
58 } // namespace content
60 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_