summaryrefslogtreecommitdiffstats
path: root/cc/output/renderer.h
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 07:24:30 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 07:24:30 +0000
commit7f0d825f49dde66a6e9137a4e35460765bc5f0d8 (patch)
tree6944603cf2a97934afad6e599500ff45091316ed /cc/output/renderer.h
parent95e4e1a0fda6929b47702e69e4ddfe384b5d014b (diff)
downloadchromium_src-7f0d825f49dde66a6e9137a4e35460765bc5f0d8.zip
chromium_src-7f0d825f49dde66a6e9137a4e35460765bc5f0d8.tar.gz
chromium_src-7f0d825f49dde66a6e9137a4e35460765bc5f0d8.tar.bz2
Part 4 of cc/ directory shuffles: output
Continuation of https://src.chromium.org/viewvc/chrome?view=rev&revision=188681 BUG=190824 TBR=piman@chromium.org, jschuh@chromium.org Review URL: https://codereview.chromium.org/12912006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188689 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output/renderer.h')
-rw-r--r--cc/output/renderer.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/cc/output/renderer.h b/cc/output/renderer.h
new file mode 100644
index 0000000..1c309ac
--- /dev/null
+++ b/cc/output/renderer.h
@@ -0,0 +1,90 @@
+// Copyright 2012 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 CC_OUTPUT_RENDERER_H_
+#define CC_OUTPUT_RENDERER_H_
+
+#include "base/basictypes.h"
+#include "cc/base/cc_export.h"
+#include "cc/layer_tree_host.h"
+#include "cc/managed_memory_policy.h"
+#include "cc/render_pass.h"
+
+namespace cc {
+
+class CompositorFrameAck;
+class CompositorFrameMetadata;
+class ScopedResource;
+
+class CC_EXPORT RendererClient {
+ public:
+ virtual gfx::Size DeviceViewportSize() const = 0;
+ virtual const LayerTreeSettings& Settings() const = 0;
+ virtual void DidLoseOutputSurface() = 0;
+ virtual void OnSwapBuffersComplete() = 0;
+ virtual void SetFullRootLayerDamage() = 0;
+ virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) = 0;
+ virtual void EnforceManagedMemoryPolicy(
+ const ManagedMemoryPolicy& policy) = 0;
+ virtual bool HasImplThread() const = 0;
+ virtual bool ShouldClearRootRenderPass() const = 0;
+ virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const = 0;
+
+ protected:
+ virtual ~RendererClient() {}
+};
+
+class CC_EXPORT Renderer {
+ public:
+ virtual ~Renderer() {}
+
+ virtual const RendererCapabilities& Capabilities() const = 0;
+
+ const LayerTreeSettings& Settings() const { return client_->Settings(); }
+
+ gfx::Size ViewportSize() const { return client_->DeviceViewportSize(); }
+ int ViewportWidth() const { return ViewportSize().width(); }
+ int ViewportHeight() const { return ViewportSize().height(); }
+
+ virtual void ViewportChanged() {}
+ virtual void ReceiveCompositorFrameAck(const CompositorFrameAck& ack) {}
+
+ virtual void DecideRenderPassAllocationsForFrame(
+ const RenderPassList& render_passes_in_draw_order) {}
+ virtual bool HaveCachedResourcesForRenderPassId(RenderPass::Id id) const;
+
+ // This passes ownership of the render passes to the renderer. It should
+ // consume them, and empty the list.
+ virtual void DrawFrame(RenderPassList& render_passes_in_draw_order) = 0;
+
+ // Waits for rendering to finish.
+ virtual void Finish() = 0;
+
+ virtual void DoNoOp() {}
+
+ // Puts backbuffer onscreen.
+ virtual bool SwapBuffers() = 0;
+
+ virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) = 0;
+
+ virtual bool IsContextLost();
+
+ virtual void SetVisible(bool visible) = 0;
+
+ virtual void SendManagedMemoryStats(size_t bytes_visible,
+ size_t bytes_visible_and_nearby,
+ size_t bytes_allocated) = 0;
+
+ protected:
+ explicit Renderer(RendererClient* client)
+ : client_(client) {}
+
+ RendererClient* client_;
+
+ DISALLOW_COPY_AND_ASSIGN(Renderer);
+};
+
+}
+
+#endif // CC_OUTPUT_RENDERER_H_