Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / browser / android / synchronous_compositor.h
blob781071b1a79cb9e7b9367ddc2ea192b6c9367a4c
1 // Copyright 2013 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.
5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h"
10 #include "gpu/command_buffer/service/in_process_command_buffer.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h"
14 class SkCanvas;
16 namespace cc {
17 class CompositorFrame;
18 class CompositorFrameAck;
21 namespace gfx {
22 class Transform;
25 namespace gpu {
26 class GLInProcessContext;
29 namespace content {
31 class SynchronousCompositorClient;
32 class WebContents;
34 // Interface for embedders that wish to direct compositing operations
35 // synchronously under their own control. Only meaningful when the
36 // kEnableSyncrhonousRendererCompositor flag is specified.
37 class CONTENT_EXPORT SynchronousCompositor {
38 public:
39 // Must be called once per WebContents instance. Will create the compositor
40 // instance as needed, but only if |client| is non-nullptr.
41 static void SetClientForWebContents(WebContents* contents,
42 SynchronousCompositorClient* client);
44 static void SetGpuService(
45 scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
47 // By default, synchronous compopsitor records the full layer, not only
48 // what is inside and around the view port. This can be used to switch
49 // between this record-full-layer behavior and normal record-around-viewport
50 // behavior.
51 static void SetRecordFullDocument(bool record_full_document);
53 // Turn on using ipc-based command buffer at run time. This should be removed
54 // once this feature is fully launched.
55 static void SetUseIpcCommandBuffer();
57 // "On demand" hardware draw. The content is first clipped to |damage_area|,
58 // then transformed through |transform|, and finally clipped to |view_size|.
59 virtual scoped_ptr<cc::CompositorFrame> DemandDrawHw(
60 gfx::Size surface_size,
61 const gfx::Transform& transform,
62 gfx::Rect viewport,
63 gfx::Rect clip,
64 gfx::Rect viewport_rect_for_tile_priority,
65 const gfx::Transform& transform_for_tile_priority) = 0;
67 // For delegated rendering, return resources from parent compositor to this.
68 // Note that all resources must be returned before ReleaseHwDraw.
69 virtual void ReturnResources(const cc::CompositorFrameAck& frame_ack) = 0;
71 // "On demand" SW draw, into the supplied canvas (observing the transform
72 // and clip set there-in).
73 virtual bool DemandDrawSw(SkCanvas* canvas) = 0;
75 // Set the memory limit policy of this compositor.
76 virtual void SetMemoryPolicy(size_t bytes_limit) = 0;
78 // Should be called by the embedder after the embedder had modified the
79 // scroll offset of the root layer (as returned by
80 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset).
81 virtual void DidChangeRootLayerScrollOffset() = 0;
83 // Called by the embedder to notify that the compositor is active. The
84 // compositor won't ask for vsyncs when it's inactive. NOTE: The compositor
85 // starts off as inactive and needs a SetActive(true) call to begin.
86 virtual void SetIsActive(bool is_active) = 0;
88 protected:
89 virtual ~SynchronousCompositor() {}
92 } // namespace content
94 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_