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 "blimp/client/core/compositor/blimp_output_surface.h" |
| 11 #include "cc/output/output_surface.h" |
| 12 |
| 13 namespace base { |
| 14 class SingleThreadTaskRunner; |
| 15 } // namespace base |
| 16 |
| 17 namespace cc { |
| 18 class ContextProvider; |
| 19 } // namespace cc |
| 20 |
| 21 namespace blimp { |
| 22 namespace client { |
| 23 |
| 24 // This class is created on the main thread, but then becomes bound to the |
| 25 // compositor thread and will be destroyed there (soon, crbug.com/640730). |
| 26 class DelegatedOutputSurface : public cc::OutputSurface, |
| 27 public BlimpOutputSurface { |
| 28 public: |
| 29 DelegatedOutputSurface( |
| 30 scoped_refptr<cc::ContextProvider> compositor_context_provider, |
| 31 scoped_refptr<cc::ContextProvider> worker_context_provider, |
| 32 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 33 base::WeakPtr<BlimpOutputSurfaceClient> client); |
| 34 |
| 35 ~DelegatedOutputSurface() override; |
| 36 |
| 37 // cc::OutputSurface implementation. |
| 38 uint32_t GetFramebufferCopyTextureFormat() override; |
| 39 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 40 void SwapBuffers(cc::CompositorFrame frame) override; |
| 41 void DetachFromClient() override; |
| 42 |
| 43 // BlimpOutputSurface implementation. |
| 44 void ReclaimCompositorResources( |
| 45 const cc::ReturnedResourceArray& resources) override; |
| 46 |
| 47 private: |
| 48 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 49 base::WeakPtr<BlimpOutputSurfaceClient> client_; |
| 50 |
| 51 bool bound_to_client_; |
| 52 |
| 53 base::WeakPtrFactory<DelegatedOutputSurface> weak_factory_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(DelegatedOutputSurface); |
| 56 }; |
| 57 |
| 58 } // namespace client |
| 59 } // namespace blimp |
| 60 |
| 61 #endif // BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |
OLD | NEW |