Index: blimp/client/core/compositor/delegated_output_surface.h |
diff --git a/blimp/client/core/compositor/delegated_output_surface.h b/blimp/client/core/compositor/delegated_output_surface.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3bbbe65a277e2c7835b0bc40ef98496b59671ae4 |
--- /dev/null |
+++ b/blimp/client/core/compositor/delegated_output_surface.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |
+#define BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "cc/output/output_surface.h" |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+} // namespace base |
+ |
+namespace cc { |
+class ContextProvider; |
+} // namespace cc |
+ |
+namespace blimp { |
+namespace client { |
+class OutputSurfaceProxy; |
+ |
+class DelegatedOutputSurface : public cc::OutputSurface { |
+ public: |
+ DelegatedOutputSurface( |
+ scoped_refptr<cc::ContextProvider> compositor_context_provider, |
+ scoped_refptr<cc::ContextProvider> worker_context_provider, |
+ scoped_refptr<base::SingleThreadTaskRunner> proxy_task_runner, |
+ base::WeakPtr<OutputSurfaceProxy> output_surface_proxy); |
+ |
+ ~DelegatedOutputSurface() override; |
+ |
+ private: |
+ class OutputSurfaceThreadPipe; |
+ |
+ // cc::OutputSurface implementation. |
+ uint32_t GetFramebufferCopyTextureFormat() override; |
+ void SwapBuffers(cc::CompositorFrame frame) override; |
+ bool BindToClient(cc::OutputSurfaceClient* client) override; |
+ void DetachFromClient() override; |
+ |
+ // These hold valid values only until the point when they are passed to the |
+ // OutputSurfaceThreadPipe. |
+ scoped_refptr<base::SingleThreadTaskRunner> proxy_task_runner_; |
+ base::WeakPtr<OutputSurfaceProxy> output_surface_proxy_; |
+ |
+ // The lifetime of this object is tied to the duration for which the |
+ // cc::OutputSurface remains bound to its client. It is created on the |
+ // compositor thread when the cc::OutputSurface successfully binds to its |
+ // client, and destroyed when it is detached. |
+ std::unique_ptr<OutputSurfaceThreadPipe> output_surface_thread_pipe_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DelegatedOutputSurface); |
+}; |
+ |
+} // namespace client |
+} // namespace blimp |
+ |
+#endif // BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ |