Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: content/browser/compositor/browser_compositor_view_mac.h

Issue 1841153002: BrowserCompositorMac, ResizeLock, DelegatedFrameHost => content/browser/renderer_host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Mac Build Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
7
8 #include "base/macros.h"
9 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
10 #include "ui/compositor/compositor.h"
11 #include "ui/compositor/compositor_observer.h"
12
13 namespace content {
14
15 // A ui::Compositor and a gfx::AcceleratedWidget (and helper) that it draws
16 // into. This structure is used to efficiently recycle these structures across
17 // tabs (because creating a new ui::Compositor for each tab would be expensive
18 // in terms of time and resources).
19 class BrowserCompositorMac : public ui::CompositorObserver {
20 public:
21 virtual ~BrowserCompositorMac();
22
23 // Create a compositor, or recycle a preexisting one.
24 static scoped_ptr<BrowserCompositorMac> Create();
25
26 // Delete a compositor, or allow it to be recycled.
27 static void Recycle(scoped_ptr<BrowserCompositorMac> compositor);
28
29 // Indicate that the recyclable compositor should be destroyed, and no future
30 // compositors should be recycled.
31 static void DisableRecyclingForShutdown();
32
33 ui::Compositor* compositor() { return &compositor_; }
34 ui::AcceleratedWidgetMac* accelerated_widget_mac() {
35 return accelerated_widget_mac_.get();
36 }
37
38 // Suspend will prevent the compositor from producing new frames. This should
39 // be called to avoid creating spurious frames while changing state.
40 // Compositors are created as suspended.
41 void Suspend();
42 void Unsuspend();
43
44 private:
45 BrowserCompositorMac();
46
47 // ui::CompositorObserver implementation:
48 void OnCompositingDidCommit(ui::Compositor* compositor) override;
49 void OnCompositingStarted(ui::Compositor* compositor,
50 base::TimeTicks start_time) override {}
51 void OnCompositingEnded(ui::Compositor* compositor) override {}
52 void OnCompositingAborted(ui::Compositor* compositor) override {}
53 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {}
54 void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
55
56 scoped_ptr<ui::AcceleratedWidgetMac> accelerated_widget_mac_;
57 ui::Compositor compositor_;
58 scoped_refptr<ui::CompositorLock> compositor_suspended_lock_;
59
60 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMac);
61 };
62
63 // A class to keep around whenever a BrowserCompositorMac may be created.
64 // While at least one instance of this class exists, a spare
65 // BrowserCompositorViewCocoa will be kept around to be recycled so that the
66 // next BrowserCompositorMac to be created will be be created quickly.
67 class BrowserCompositorMacPlaceholder {
68 public:
69 BrowserCompositorMacPlaceholder();
70 ~BrowserCompositorMacPlaceholder();
71
72 private:
73 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorMacPlaceholder);
74 };
75
76 } // namespace content
77
78 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/compositor/browser_compositor_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698