| 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 <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "cc/surfaces/display_client.h" | 14 #include "cc/surfaces/display_client.h" |
| 14 #include "cc/surfaces/surface_factory.h" | 15 #include "cc/surfaces/surface_factory.h" |
| 15 #include "cc/surfaces/surface_factory_client.h" | 16 #include "cc/surfaces/surface_factory_client.h" |
| 16 #include "components/mus/gles2/gpu_state.h" | 17 #include "components/mus/gles2/gpu_state.h" |
| 17 #include "components/mus/public/interfaces/window_manager.mojom.h" | 18 #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.h" |
| 19 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" | 20 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" |
| 20 #include "components/mus/surfaces/surfaces_state.h" | 21 #include "components/mus/surfaces/surfaces_state.h" |
| 21 #include "mojo/public/cpp/bindings/strong_binding.h" | 22 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 22 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 // scheduled to be generated here based on VSync. | 40 // scheduled to be generated here based on VSync. |
| 40 class TopLevelDisplayClient : public cc::DisplayClient, | 41 class TopLevelDisplayClient : public cc::DisplayClient, |
| 41 public cc::SurfaceFactoryClient, | 42 public cc::SurfaceFactoryClient, |
| 42 public SurfacesContextProviderDelegate { | 43 public SurfacesContextProviderDelegate { |
| 43 public: | 44 public: |
| 44 TopLevelDisplayClient(gfx::AcceleratedWidget widget, | 45 TopLevelDisplayClient(gfx::AcceleratedWidget widget, |
| 45 const scoped_refptr<GpuState>& gpu_state, | 46 const scoped_refptr<GpuState>& gpu_state, |
| 46 const scoped_refptr<SurfacesState>& surfaces_state); | 47 const scoped_refptr<SurfacesState>& surfaces_state); |
| 47 ~TopLevelDisplayClient() override; | 48 ~TopLevelDisplayClient() override; |
| 48 | 49 |
| 49 void SubmitCompositorFrame(scoped_ptr<cc::CompositorFrame> frame, | 50 void SubmitCompositorFrame(std::unique_ptr<cc::CompositorFrame> frame, |
| 50 const base::Closure& callback); | 51 const base::Closure& callback); |
| 51 const cc::SurfaceId& surface_id() const { return cc_id_; } | 52 const cc::SurfaceId& surface_id() const { return cc_id_; } |
| 52 | 53 |
| 53 void RequestCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> output_request); | 54 void RequestCopyOfOutput( |
| 55 std::unique_ptr<cc::CopyOutputRequest> output_request); |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 // DisplayClient implementation. | 58 // DisplayClient implementation. |
| 57 // TODO(rjkroege, fsamuel): This won't work correctly with multiple displays. | 59 // TODO(rjkroege, fsamuel): This won't work correctly with multiple displays. |
| 58 void CommitVSyncParameters(base::TimeTicks timebase, | 60 void CommitVSyncParameters(base::TimeTicks timebase, |
| 59 base::TimeDelta interval) override; | 61 base::TimeDelta interval) override; |
| 60 void OutputSurfaceLost() override; | 62 void OutputSurfaceLost() override; |
| 61 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 63 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
| 62 | 64 |
| 63 // SurfacesContextProviderDelegate: | 65 // SurfacesContextProviderDelegate: |
| 64 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; | 66 void OnVSyncParametersUpdated(int64_t timebase, int64_t interval) override; |
| 65 | 67 |
| 66 // SurfaceFactoryClient implementation. | 68 // SurfaceFactoryClient implementation. |
| 67 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 69 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 68 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 70 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 69 | 71 |
| 70 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 72 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 71 scoped_refptr<SurfacesState> surfaces_state_; | 73 scoped_refptr<SurfacesState> surfaces_state_; |
| 72 cc::SurfaceFactory factory_; | 74 cc::SurfaceFactory factory_; |
| 73 cc::SurfaceId cc_id_; | 75 cc::SurfaceId cc_id_; |
| 74 | 76 |
| 75 gfx::Size last_submitted_frame_size_; | 77 gfx::Size last_submitted_frame_size_; |
| 76 scoped_ptr<cc::CompositorFrame> pending_frame_; | 78 std::unique_ptr<cc::CompositorFrame> pending_frame_; |
| 77 | 79 |
| 78 scoped_ptr<cc::SyntheticBeginFrameSource> synthetic_frame_source_; | 80 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_frame_source_; |
| 79 scoped_ptr<cc::DisplayScheduler> scheduler_; | 81 std::unique_ptr<cc::DisplayScheduler> scheduler_; |
| 80 scoped_ptr<cc::Display> display_; | 82 std::unique_ptr<cc::Display> display_; |
| 81 | 83 |
| 82 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); | 84 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 } // namespace mus | 87 } // namespace mus |
| 86 | 88 |
| 87 #endif // COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ | 89 #endif // COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ |
| OLD | NEW |