| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "blimp/client/support/compositor/blimp_embedder_compositor.h" | 5 #include "blimp/client/support/compositor/blimp_embedder_compositor.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "blimp/client/public/compositor/compositor_dependencies.h" | 10 #include "blimp/client/public/compositor/compositor_dependencies.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 class DisplayOutputSurface : public cc::OutputSurface { | 41 class DisplayOutputSurface : public cc::OutputSurface { |
| 42 public: | 42 public: |
| 43 explicit DisplayOutputSurface( | 43 explicit DisplayOutputSurface( |
| 44 scoped_refptr<cc::ContextProvider> context_provider) | 44 scoped_refptr<cc::ContextProvider> context_provider) |
| 45 : cc::OutputSurface(std::move(context_provider)) {} | 45 : cc::OutputSurface(std::move(context_provider)) {} |
| 46 | 46 |
| 47 ~DisplayOutputSurface() override = default; | 47 ~DisplayOutputSurface() override = default; |
| 48 | 48 |
| 49 // cc::OutputSurface implementation | 49 // cc::OutputSurface implementation |
| 50 void EnsureBackbuffer() override {} |
| 51 void DiscardBackbuffer() override { |
| 52 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); |
| 53 } |
| 54 void BindFramebuffer() override { |
| 55 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); |
| 56 } |
| 50 void SwapBuffers(cc::CompositorFrame frame) override { | 57 void SwapBuffers(cc::CompositorFrame frame) override { |
| 51 // See cc::OutputSurface::SwapBuffers() comment for details. | 58 // See cc::OutputSurface::SwapBuffers() comment for details. |
| 52 context_provider_->ContextSupport()->Swap(); | 59 context_provider_->ContextSupport()->Swap(); |
| 53 cc::OutputSurface::PostSwapBuffersComplete(); | 60 cc::OutputSurface::PostSwapBuffersComplete(); |
| 54 } | 61 } |
| 55 | 62 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override { |
| 63 return nullptr; |
| 64 } |
| 65 bool IsDisplayedAsOverlayPlane() const override { return false; } |
| 66 unsigned GetOverlayTextureId() const override { return 0; } |
| 67 bool SurfaceIsSuspendForRecycle() const override { return false; } |
| 56 uint32_t GetFramebufferCopyTextureFormat() override { | 68 uint32_t GetFramebufferCopyTextureFormat() override { |
| 57 // We assume we have an alpha channel from the BlimpContextProvider, so use | 69 // We assume we have an alpha channel from the BlimpContextProvider, so use |
| 58 // GL_RGBA here. | 70 // GL_RGBA here. |
| 59 return GL_RGBA; | 71 return GL_RGBA; |
| 60 } | 72 } |
| 73 bool HasExternalStencilTest() const override { return false; } |
| 74 void ApplyExternalStencil() override {} |
| 61 | 75 |
| 62 private: | 76 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(DisplayOutputSurface); | 77 DISALLOW_COPY_AND_ASSIGN(DisplayOutputSurface); |
| 64 }; | 78 }; |
| 65 | 79 |
| 66 base::LazyInstance<SimpleTaskGraphRunner> g_task_graph_runner = | 80 base::LazyInstance<SimpleTaskGraphRunner> g_task_graph_runner = |
| 67 LAZY_INSTANCE_INITIALIZER; | 81 LAZY_INSTANCE_INITIALIZER; |
| 68 | 82 |
| 69 } // namespace | 83 } // namespace |
| 70 | 84 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // The Browser compositor and display share the same context provider. | 202 // The Browser compositor and display share the same context provider. |
| 189 auto compositor_frame_sink = base::MakeUnique<cc::DirectCompositorFrameSink>( | 203 auto compositor_frame_sink = base::MakeUnique<cc::DirectCompositorFrameSink>( |
| 190 compositor_dependencies_->GetSurfaceManager(), | 204 compositor_dependencies_->GetSurfaceManager(), |
| 191 surface_id_allocator_.get(), display_.get(), context_provider_, nullptr); | 205 surface_id_allocator_.get(), display_.get(), context_provider_, nullptr); |
| 192 | 206 |
| 193 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 207 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
| 194 } | 208 } |
| 195 | 209 |
| 196 } // namespace client | 210 } // namespace client |
| 197 } // namespace blimp | 211 } // namespace blimp |
| OLD | NEW |