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

Side by Side Diff: content/public/browser/android/synchronous_compositor.h

Issue 15851006: Move synchronous compositor into content/browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mkosiba comments1 Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
6 #define CONTENT_PUBLIC_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
7 7
8 #include "ui/gfx/rect.h" 8 #include "ui/gfx/rect.h"
9 #include "ui/gfx/size.h" 9 #include "ui/gfx/size.h"
10 10
11 class SkCanvas; 11 class SkCanvas;
12 12
13 namespace gfx { 13 namespace gfx {
14 class Transform; 14 class Transform;
15 }; 15 };
16 16
17 namespace content { 17 namespace content {
18 18
19 class WebContents;
20
19 class SynchronousCompositorClient; 21 class SynchronousCompositorClient;
20 22
21 // Interface for embedders that wish to direct compositing operations 23 // Interface for embedders that wish to direct compositing operations
22 // synchronously under their own control. Only meaningful when the 24 // synchronously under their own control. Only meaningful when the
23 // kEnableSyncrhonousRendererCompositor flag is specified. 25 // kEnableSyncrhonousRendererCompositor flag is specified.
24 class SynchronousCompositor { 26 class SynchronousCompositor {
25 public: 27 public:
28 // Must be called once on startup, to install the synchronous compositing
29 // machinery into this process.
30 static void Init();
31
32 // Must be called once per WebContents instance. Ownership of |contents|
33 // is not transferred; ownership of the SynchronousCompositor is not returned.
34 static SynchronousCompositor* GetOrCreateForWebContents(
35 WebContents* contents);
36
26 // Allows changing or resetting the client to NULL (this must be used if 37 // Allows changing or resetting the client to NULL (this must be used if
27 // the client is being deleted prior to the DidDestroyCompositor() call 38 // the client is being deleted prior to the DidDestroyCompositor() call
28 // being received by the client). Ownership of |client| remains with 39 // being received by the client). Ownership of |client| remains with
29 // the caller. 40 // the caller.
30 virtual void SetClient(SynchronousCompositorClient* client) = 0; 41 virtual void SetClient(SynchronousCompositorClient* client) = 0;
31 42
32 // Returns true if the compositor is fully initialized and ready to receive 43 // Returns true if the compositor is fully initialized and ready to receive
33 // calls to DemandDrawHw(). 44 // calls to DemandDrawHw().
34 virtual bool IsHwReady() = 0; 45 virtual bool IsHwReady() = 0;
35 46
36 // "On demand" SW draw, into the supplied canvas (observing the transform 47 // "On demand" SW draw, into the supplied canvas (observing the transform
37 // and clip set there-in). 48 // and clip set there-in).
38 virtual bool DemandDrawSw(SkCanvas* canvas) = 0; 49 virtual bool DemandDrawSw(SkCanvas* canvas) = 0;
39 50
40 // "On demand" hardware draw. The content is first clipped to |damage_area|, 51 // "On demand" hardware draw. The content is first clipped to |damage_area|,
41 // then transformed through |transform|, and finally clipped to |view_size|. 52 // then transformed through |transform|, and finally clipped to |view_size|.
42 virtual bool DemandDrawHw( 53 virtual bool DemandDrawHw(
43 gfx::Size view_size, 54 gfx::Size view_size,
44 const gfx::Transform& transform, 55 const gfx::Transform& transform,
45 gfx::Rect damage_area) = 0; 56 gfx::Rect damage_area) = 0;
46 57
47 protected: 58 protected:
48 virtual ~SynchronousCompositor() {} 59 virtual ~SynchronousCompositor() {}
49 }; 60 };
50 61
51 } // namespace content 62 } // namespace content
52 63
53 #endif // CONTENT_PUBLIC_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 64 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698