Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: blimp/client/core/compositor/output_surface_proxy.h

Issue 2266863003: blimp: Move BlimpCompositor to use delegated rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/compositor/output_surface_proxy.h
diff --git a/blimp/client/core/compositor/output_surface_proxy.h b/blimp/client/core/compositor/output_surface_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..e1a5053e5e8f3191a5c84d4e26ddf90673edc583
--- /dev/null
+++ b/blimp/client/core/compositor/output_surface_proxy.h
@@ -0,0 +1,59 @@
+// 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_OUTPUT_SURFACE_PROXY_H_
+#define BLIMP_CLIENT_CORE_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "cc/resources/returned_resource.h"
+
+namespace cc {
+class CompositorFrame;
+}
+
+namespace blimp {
+namespace client {
+
+// The client is the class for the proxy to interact with the cc::OutputSurface.
+// It should only be called on the compositor thread.
+class OutputSurfaceProxyClient {
+ public:
+ virtual ~OutputSurfaceProxyClient() {}
+
+ // Sent when the compositor can safely reclaim the |resources| references in
+ // a compositor frame.
+ virtual void ReclaimCompositorResources(
+ const cc::ReturnedResourceArray& resources) = 0;
+};
+
+// This class is meant to be a proxy for the OutputSurface to interact with the
+// consumer of the CompositorFrames. All calls to the OutputSurfaceProxy are
+// made on the thread on which proxy exists.
+class OutputSurfaceProxy {
+ public:
+ virtual ~OutputSurfaceProxy() {}
+
+ // Will be called when the cc::OutputSurface is bound to its client on the
+ // compositor thread. The weak ptr to the client can be used to post messages
+ // to it on the compositor thread. This *must* be called before any messages
+ // are sent to the proxy.
+ virtual void BindToClient(base::WeakPtr<OutputSurfaceProxyClient> client) = 0;
+
+ // The implementation should take the contents of the compositor frame and
+ // return the referenced resources when the frame is no longer being draw
+ // using OutputSurfaceProxyClient::ReclaimCompositorResources.
+ virtual void SwapCompositorFrame(cc::CompositorFrame frame) = 0;
+
+ // Will be called when the cc::OutputSurface detaches itself from its client
+ // on the compositor thread. Any messages sent to the client beyond this point
+ // will be silently dropped and no more messages can be sent to the proxy
+ // going forward.
+ virtual void DetachFromClient() = 0;
+};
+
+} // namespace client
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_CORE_COMPOSITOR_OUTPUT_SURFACE_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698