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_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_
6 #define CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
13 class MessageLoopProxy;
17 class ContextProvider;
23 class ContextProviderWebContext;
29 class InputHandlerManagerClient;
30 class StreamTextureFactory;
32 // Decouples creation from usage of the parts needed for the synchonous
33 // compositor rendering path. In practice this is only used in single
34 // process mode (namely, for Android WebView) hence the implementation of
35 // this will be injected from the logical 'browser' side code.
36 class SynchronousCompositorFactory {
38 // Must only be called once, e.g. on startup. Ownership of |instance| remains
40 static void SetInstance(SynchronousCompositorFactory* instance);
41 static SynchronousCompositorFactory* GetInstance();
43 virtual scoped_refptr<base::MessageLoopProxy>
44 GetCompositorMessageLoop() = 0;
45 virtual bool RecordFullLayer() = 0;
46 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
49 // The factory maintains ownership of the returned interface.
50 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
52 virtual scoped_refptr<webkit::gpu::ContextProviderWebContext>
53 GetSharedOffscreenContextProviderForMainThread() = 0;
54 virtual scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
56 virtual blink::WebGraphicsContext3D* CreateOffscreenGraphicsContext3D(
57 const blink::WebGraphicsContext3D::Attributes& attributes) = 0;
60 SynchronousCompositorFactory() {}
61 virtual ~SynchronousCompositorFactory() {}
66 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_