OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ | 5 #ifndef COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ |
6 #define COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ | 6 #define COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/surfaces/display_client.h" | 9 #include "cc/surfaces/display_client.h" |
10 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
11 #include "cc/surfaces/surface_factory_client.h" | 11 #include "cc/surfaces/surface_factory_client.h" |
| 12 #include "components/mus/gles2/gpu_state.h" |
12 #include "components/mus/surfaces/surfaces_context_provider.h" | 13 #include "components/mus/surfaces/surfaces_context_provider.h" |
13 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" | 14 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" |
14 #include "components/mus/surfaces/surfaces_state.h" | 15 #include "components/mus/surfaces/surfaces_state.h" |
15 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 16 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
16 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 class Display; | 20 class Display; |
20 class SurfaceFactory; | 21 class SurfaceFactory; |
21 } | 22 } |
22 | 23 |
23 namespace gles2 { | 24 namespace mus { |
24 class GpuState; | |
25 } | |
26 | |
27 namespace surfaces { | |
28 | 25 |
29 class DisplayDelegate; | 26 class DisplayDelegate; |
30 class SurfacesScheduler; | 27 class SurfacesScheduler; |
31 class SurfacesState; | 28 class SurfacesState; |
32 | 29 |
33 // A TopLevelDisplayClient manages the top level surface that is rendered into a | 30 // A TopLevelDisplayClient manages the top level surface that is rendered into a |
34 // provided AcceleratedWidget. Frames are submitted here. New frames are | 31 // provided AcceleratedWidget. Frames are submitted here. New frames are |
35 // scheduled to be generated here based on VSync. | 32 // scheduled to be generated here based on VSync. |
36 class TopLevelDisplayClient : public cc::DisplayClient, | 33 class TopLevelDisplayClient : public cc::DisplayClient, |
37 public cc::SurfaceFactoryClient, | 34 public cc::SurfaceFactoryClient, |
38 public surfaces::SurfacesContextProviderDelegate { | 35 public SurfacesContextProviderDelegate { |
39 public: | 36 public: |
40 TopLevelDisplayClient(gfx::AcceleratedWidget widget, | 37 TopLevelDisplayClient(gfx::AcceleratedWidget widget, |
41 const scoped_refptr<gles2::GpuState>& gpu_state, | 38 const scoped_refptr<GpuState>& gpu_state, |
42 const scoped_refptr<SurfacesState>& surfaces_state); | 39 const scoped_refptr<SurfacesState>& surfaces_state); |
43 ~TopLevelDisplayClient() override; | 40 ~TopLevelDisplayClient() override; |
44 | 41 |
45 void SubmitCompositorFrame(scoped_ptr<cc::CompositorFrame> frame, | 42 void SubmitCompositorFrame(scoped_ptr<cc::CompositorFrame> frame, |
46 const base::Closure& callback); | 43 const base::Closure& callback); |
47 | 44 |
48 private: | 45 private: |
49 // DisplayClient implementation. | 46 // DisplayClient implementation. |
50 // TODO(rjkroege, fsamuel): This won't work correctly with multiple displays. | 47 // TODO(rjkroege, fsamuel): This won't work correctly with multiple displays. |
51 void CommitVSyncParameters(base::TimeTicks timebase, | 48 void CommitVSyncParameters(base::TimeTicks timebase, |
52 base::TimeDelta interval) override; | 49 base::TimeDelta interval) override; |
53 void OutputSurfaceLost() override; | 50 void OutputSurfaceLost() override; |
54 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 51 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
55 | 52 |
56 // SurfacesContextProviderDelegate: | 53 // SurfacesContextProviderDelegate: |
57 void OnContextCreated(); | 54 void OnContextCreated(); |
58 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; | 55 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; |
59 | 56 |
60 // SurfaceFactoryClient implementation. | 57 // SurfaceFactoryClient implementation. |
61 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 58 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
62 | 59 |
63 scoped_refptr<gles2::GpuState> gpu_state_; | 60 scoped_refptr<GpuState> gpu_state_; |
64 scoped_refptr<SurfacesState> surfaces_state_; | 61 scoped_refptr<SurfacesState> surfaces_state_; |
65 cc::SurfaceFactory factory_; | 62 cc::SurfaceFactory factory_; |
66 cc::SurfaceId cc_id_; | 63 cc::SurfaceId cc_id_; |
67 | 64 |
68 gfx::Size last_submitted_frame_size_; | 65 gfx::Size last_submitted_frame_size_; |
69 scoped_ptr<cc::CompositorFrame> pending_frame_; | 66 scoped_ptr<cc::CompositorFrame> pending_frame_; |
70 | 67 |
71 scoped_ptr<cc::Display> display_; | 68 scoped_ptr<cc::Display> display_; |
72 | 69 |
73 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); | 70 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); |
74 }; | 71 }; |
75 | 72 |
76 } // namespace surfaces | 73 } // namespace mus |
77 | 74 |
78 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ | 75 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_IMPL_H_ |
OLD | NEW |