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