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_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ |
6 #define COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | 6 #define COMPONENTS_VIEW_MANAGER_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/view_manager/public/interfaces/display.mojom.h" | 12 #include "components/view_manager/public/interfaces/surfaces.mojom.h" |
13 #include "components/view_manager/surfaces/surfaces_context_provider.h" | |
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
15 #include "ui/gfx/native_widget_types.h" | |
14 | 16 |
15 namespace cc { | 17 namespace cc { |
16 class Display; | 18 class Display; |
17 class SurfaceFactory; | 19 class SurfaceFactory; |
18 } | 20 } |
19 | 21 |
22 namespace gles2 { | |
23 class GpuState; | |
24 } | |
25 | |
20 namespace surfaces { | 26 namespace surfaces { |
21 class SurfacesScheduler; | 27 class SurfacesScheduler; |
22 class SurfacesServiceApplication; | 28 class SurfacesState; |
23 | 29 |
24 class DisplayImpl : public mojo::Display, | 30 // A TopLevelDisplayClient manages the top level surface that is rendered into a |
25 public mojo::ViewportParameterListener, | 31 // provided AcceleratedWidget. Frames are submitted here. New frames are |
rjkroege
2015/08/13 17:45:38
my presumption is that this happens on different t
Fady Samuel
2015/08/17 15:38:05
TopLevelDisplayClient lives on the same thread as
| |
26 public cc::DisplayClient, | 32 // scheduled to be generated here based on VSync. |
27 public cc::SurfaceFactoryClient { | 33 class TopLevelDisplayClient |
34 : public cc::DisplayClient, | |
35 public cc::SurfaceFactoryClient, | |
36 public surfaces::SurfacesContextProvider::Delegate { | |
28 public: | 37 public: |
29 DisplayImpl(SurfacesServiceApplication* application, | 38 TopLevelDisplayClient(gfx::AcceleratedWidget widget, |
30 cc::SurfaceManager* manager, | 39 const scoped_refptr<gles2::GpuState>& gpu_state, |
31 cc::SurfaceId cc_id, | 40 const scoped_refptr<SurfacesState>& surfaces_state); |
32 SurfacesScheduler* scheduler, | 41 ~TopLevelDisplayClient() override; |
33 mojo::ContextProviderPtr context_provider, | 42 |
34 mojo::ResourceReturnerPtr returner, | 43 void SubmitFrame(mojo::FramePtr frame, const base::Closure& callback); |
35 mojo::InterfaceRequest<mojo::Display> display_request); | |
36 ~DisplayImpl() override; | |
37 | 44 |
38 private: | 45 private: |
39 void OnContextCreated(mojo::CommandBufferPtr gles2_client); | |
40 | |
41 // mojo::Display implementation: | |
42 void SubmitFrame(mojo::FramePtr frame, | |
43 const SubmitFrameCallback& callback) override; | |
44 | |
45 // DisplayClient implementation. | 46 // DisplayClient implementation. |
46 void CommitVSyncParameters(base::TimeTicks timebase, | 47 void CommitVSyncParameters(base::TimeTicks timebase, |
47 base::TimeDelta interval) override; | 48 base::TimeDelta interval) override; |
48 void OutputSurfaceLost() override; | 49 void OutputSurfaceLost() override; |
49 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 50 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
50 | 51 |
51 // ViewportParameterListener | 52 // SurfacesContextProvider::Delegate: |
53 void OnContextCreated(); | |
52 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; | 54 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; |
53 | 55 |
54 // SurfaceFactoryClient implementation. | 56 // SurfaceFactoryClient implementation. |
55 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 57 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
56 | 58 |
57 void Draw(); | 59 void Draw(); |
58 | 60 |
59 SurfacesServiceApplication* application_; | 61 scoped_refptr<gles2::GpuState> gpu_state_; |
60 cc::SurfaceManager* manager_; | 62 scoped_refptr<SurfacesState> surfaces_state_; |
61 cc::SurfaceFactory factory_; | 63 cc::SurfaceFactory factory_; |
62 cc::SurfaceId cc_id_; | 64 cc::SurfaceId cc_id_; |
63 SurfacesScheduler* scheduler_; | |
64 mojo::ContextProviderPtr context_provider_; | |
65 mojo::ResourceReturnerPtr returner_; | |
66 | 65 |
67 gfx::Size last_submitted_frame_size_; | 66 gfx::Size last_submitted_frame_size_; |
68 mojo::FramePtr pending_frame_; | 67 mojo::FramePtr pending_frame_; |
69 SubmitFrameCallback pending_callback_; | 68 base::Closure pending_callback_; |
70 | 69 |
71 scoped_ptr<cc::Display> display_; | 70 scoped_ptr<cc::Display> display_; |
72 | 71 |
73 mojo::Binding<mojo::ViewportParameterListener> viewport_param_binding_; | 72 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); |
74 mojo::StrongBinding<mojo::Display> display_binding_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(DisplayImpl); | |
77 }; | 73 }; |
78 | 74 |
79 } // namespace surfaces | 75 } // namespace surfaces |
80 | 76 |
81 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ | 77 #endif // COMPONENTS_VIEW_MANAGER_SURFACES_DISPLAY_IMPL_H_ |
OLD | NEW |