OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ | |
6 #define BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "blimp/client/support/compositor/blimp_embedder_compositor.h" | |
10 #include "gpu/ipc/common/surface_handle.h" | |
11 #include "ui/gfx/native_widget_types.h" | |
12 | |
13 namespace blimp { | |
14 namespace client { | |
15 class CompositorDependencies; | |
16 | |
17 // A version of a BlimpEmbedderCompositor that supplies a ContextProvider backed | |
18 // by an AcceleratedWidget. The AcceleratedWidget is a platform specific hook | |
19 // that the ContextProvider can use to render to the screen. | |
20 class BrowserCompositor : public BlimpEmbedderCompositor { | |
21 public: | |
22 explicit BrowserCompositor(CompositorDependencies* compositor_dependencies); | |
23 ~BrowserCompositor() override; | |
24 | |
25 // Sets the AcceleratedWidget that will be used to display to. Once provided, | |
26 // the compositor will become visible and start drawing to the widget. When | |
27 // the widget is taken away by passing gfx::kNullAcceleratedWidget, the | |
28 // compositor will become invisible and will drop all resources being used to | |
29 // draw to the screen. | |
30 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | |
31 | |
32 // A callback to get notifed when the compositor performs a successful swap. | |
33 void set_did_complete_swap_buffers_callback(base::Closure callback) { | |
34 did_complete_swap_buffers_ = callback; | |
35 } | |
36 | |
37 protected: | |
38 // BlimpEmbedderCompositor implementation. | |
39 void DidReceiveCompositorFrameAck() override; | |
40 | |
41 gpu::SurfaceHandle surface_handle_ = gpu::kNullSurfaceHandle; | |
42 base::Closure did_complete_swap_buffers_; | |
43 | |
44 private: | |
45 DISALLOW_COPY_AND_ASSIGN(BrowserCompositor); | |
46 }; | |
47 | |
48 } // namespace client | |
49 } // namespace blimp | |
50 | |
51 #endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ | |
OLD | NEW |