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