1 // Copyright 2012 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 CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_
6 #define CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/output/begin_frame_args.h"
13 #include "cc/output/context_provider.h"
14 #include "ui/gfx/rect.h"
22 class CompositorFrameAck
;
23 struct ManagedMemoryPolicy
;
25 class CC_EXPORT OutputSurfaceClient
{
27 // Called to synchronously re-initialize using the Context3D. Upon returning
28 // the compositor should be able to draw using GL what was previously
30 virtual bool DeferredInitialize(
31 scoped_refptr
<ContextProvider
> offscreen_context_provider
) = 0;
32 virtual void ReleaseGL() = 0;
33 virtual void SetNeedsRedrawRect(gfx::Rect damage_rect
) = 0;
34 virtual void BeginImplFrame(const BeginFrameArgs
& args
) = 0;
35 virtual void OnSwapBuffersComplete() = 0;
36 virtual void ReclaimResources(const CompositorFrameAck
* ack
) = 0;
37 virtual void DidLoseOutputSurface() = 0;
38 virtual void SetExternalDrawConstraints(const gfx::Transform
& transform
,
41 bool valid_for_tile_management
) = 0;
42 virtual void SetMemoryPolicy(const ManagedMemoryPolicy
& policy
) = 0;
43 // If set, |callback| will be called subsequent to each new tree activation,
44 // regardless of the compositor visibility or damage. |callback| must remain
45 // valid for the lifetime of the OutputSurfaceClient or until unregisted --
46 // use SetTreeActivationCallback(base::Closure()) to unregister it.
47 virtual void SetTreeActivationCallback(const base::Closure
& callback
) = 0;
50 virtual ~OutputSurfaceClient() {}
55 #endif // CC_OUTPUT_OUTPUT_SURFACE_CLIENT_H_