OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |
| 6 #define BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/output/output_surface.h" |
| 11 |
| 12 namespace base { |
| 13 class SingleThreadTaskRunner; |
| 14 } // namespace base |
| 15 |
| 16 namespace cc { |
| 17 class ContextProvider; |
| 18 } // namespace cc |
| 19 |
| 20 namespace blimp { |
| 21 namespace client { |
| 22 class OutputSurfaceProxy; |
| 23 |
| 24 class DelegatedOutputSurface : public cc::OutputSurface { |
| 25 public: |
| 26 DelegatedOutputSurface( |
| 27 scoped_refptr<cc::ContextProvider> compositor_context_provider, |
| 28 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 29 scoped_refptr<base::SingleThreadTaskRunner> proxy_task_runner, |
| 30 base::WeakPtr<OutputSurfaceProxy> output_surface_proxy); |
| 31 |
| 32 ~DelegatedOutputSurface() override; |
| 33 |
| 34 private: |
| 35 class OutputSurfaceThreadPipe; |
| 36 |
| 37 // cc::OutputSurface implementation. |
| 38 uint32_t GetFramebufferCopyTextureFormat() override; |
| 39 void SwapBuffers(cc::CompositorFrame frame) override; |
| 40 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 41 void DetachFromClient() override; |
| 42 |
| 43 // These hold valid values only until the point when they are passed to the |
| 44 // OutputSurfaceThreadPipe. |
| 45 scoped_refptr<base::SingleThreadTaskRunner> proxy_task_runner_; |
| 46 base::WeakPtr<OutputSurfaceProxy> output_surface_proxy_; |
| 47 |
| 48 // The lifetime of this object is tied to the duration for which the |
| 49 // cc::OutputSurface remains bound to its client. It is created on the |
| 50 // compositor thread when the cc::OutputSurface successfully binds to its |
| 51 // client, and destroyed when it is detached. |
| 52 std::unique_ptr<OutputSurfaceThreadPipe> output_surface_thread_pipe_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DelegatedOutputSurface); |
| 55 }; |
| 56 |
| 57 } // namespace client |
| 58 } // namespace blimp |
| 59 |
| 60 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |
OLD | NEW |