| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | |
| 6 #define SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "cc/output/in_process_context_provider.h" | |
| 11 #include "cc/output/output_surface.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 class CompositorFrame; | |
| 15 class SyntheticBeginFrameSource; | |
| 16 } | |
| 17 | |
| 18 namespace ui { | |
| 19 | |
| 20 // An OutputSurface implementation that directly draws and | |
| 21 // swaps to an actual GL surface. | |
| 22 class DirectOutputSurface : public cc::OutputSurface { | |
| 23 public: | |
| 24 DirectOutputSurface( | |
| 25 scoped_refptr<cc::InProcessContextProvider> context_provider, | |
| 26 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source); | |
| 27 ~DirectOutputSurface() override; | |
| 28 | |
| 29 // cc::OutputSurface implementation | |
| 30 void BindToClient(cc::OutputSurfaceClient* client) override; | |
| 31 void EnsureBackbuffer() override; | |
| 32 void DiscardBackbuffer() override; | |
| 33 void BindFramebuffer() override; | |
| 34 void Reshape(const gfx::Size& size, | |
| 35 float device_scale_factor, | |
| 36 const gfx::ColorSpace& color_space, | |
| 37 bool has_alpha) override; | |
| 38 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | |
| 39 uint32_t GetFramebufferCopyTextureFormat() override; | |
| 40 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | |
| 41 bool IsDisplayedAsOverlayPlane() const override; | |
| 42 unsigned GetOverlayTextureId() const override; | |
| 43 bool SurfaceIsSuspendForRecycle() const override; | |
| 44 bool HasExternalStencilTest() const override; | |
| 45 void ApplyExternalStencil() override; | |
| 46 | |
| 47 | |
| 48 private: | |
| 49 // Called when a swap completion is signaled from ImageTransportSurface. | |
| 50 void OnGpuSwapBuffersCompleted( | |
| 51 const std::vector<ui::LatencyInfo>& latency_info, | |
| 52 gfx::SwapResult result, | |
| 53 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); | |
| 54 void OnVSyncParametersUpdated(base::TimeTicks timebase, | |
| 55 base::TimeDelta interval); | |
| 56 | |
| 57 cc::OutputSurfaceClient* client_ = nullptr; | |
| 58 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | |
| 59 | |
| 60 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace ui | |
| 64 | |
| 65 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | |
| OLD | NEW |