Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / mojo / examples / compositor_app / compositor_host.h
blob2576fdd2162a6ee5d27cb597186af2cb11e94866
1 // Copyright 2013 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 MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_
6 #define MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/threading/thread.h"
11 #include "cc/trees/layer_tree_host_client.h"
12 #include "mojo/public/cpp/system/core.h"
13 #include "ui/gfx/size.h"
15 namespace cc {
16 class Layer;
17 class LayerTreeHost;
18 } // namespace cc
20 namespace mojo {
21 namespace examples {
22 class GLES2ClientImpl;
24 class CompositorHost : public cc::LayerTreeHostClient {
25 public:
26 explicit CompositorHost(ScopedMessagePipeHandle command_buffer_handle);
27 virtual ~CompositorHost();
29 void SetSize(const gfx::Size& viewport_size);
31 // cc::LayerTreeHostClient implementation.
32 virtual void WillBeginMainFrame(int frame_id) OVERRIDE;
33 virtual void DidBeginMainFrame() OVERRIDE;
34 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE;
35 virtual void Layout() OVERRIDE;
36 virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
37 float page_scale) OVERRIDE;
38 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
39 OVERRIDE;
40 virtual void DidInitializeOutputSurface() OVERRIDE;
41 virtual void WillCommit() OVERRIDE;
42 virtual void DidCommit() OVERRIDE;
43 virtual void DidCommitAndDrawFrame() OVERRIDE;
44 virtual void DidCompleteSwapBuffers() OVERRIDE;
46 private:
47 void SetupScene();
49 ScopedMessagePipeHandle command_buffer_handle_;
50 scoped_ptr<cc::LayerTreeHost> tree_;
51 scoped_refptr<cc::Layer> child_layer_;
52 base::Thread compositor_thread_;
55 } // namespace examples
56 } // namespace mojo
58 #endif // MOJO_EXAMPLES_COMPOSITOR_APP_COMPOSITOR_HOST_H_