Fix crash on app list start page contents not existing.
[chromium-blink-merge.git] / content / renderer / android / synchronous_compositor_factory.h
blob7906f5f3ec8aaf1e17884429a37713c5a662d795
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"
12 namespace base {
13 class MessageLoopProxy;
16 namespace cc {
17 class BeginFrameSource;
18 class ContextProvider;
19 class OutputSurface;
22 namespace cc_blink {
23 class ContextProviderWebContext;
26 namespace gpu_blink {
27 class WebGraphicsContext3DInProcessCommandBufferImpl;
30 namespace content {
32 class InputHandlerManagerClient;
33 class StreamTextureFactory;
34 class FrameSwapMessageQueue;
36 // Decouples creation from usage of the parts needed for the synchonous
37 // compositor rendering path. In practice this is only used in single
38 // process mode (namely, for Android WebView) hence the implementation of
39 // this will be injected from the logical 'browser' side code.
40 class SynchronousCompositorFactory {
41 public:
42 // Must only be called once, e.g. on startup. Ownership of |instance| remains
43 // with the caller.
44 static void SetInstance(SynchronousCompositorFactory* instance);
45 static SynchronousCompositorFactory* GetInstance();
47 virtual scoped_refptr<base::MessageLoopProxy>
48 GetCompositorMessageLoop() = 0;
49 virtual bool RecordFullLayer() = 0;
50 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
51 int routing_id,
52 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) = 0;
54 // The factory maintains ownership of the returned interface.
55 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
57 virtual scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
58 int routing_id) = 0;
60 virtual scoped_refptr<cc_blink::ContextProviderWebContext>
61 CreateOffscreenContextProvider(
62 const blink::WebGraphicsContext3D::Attributes& attributes,
63 const std::string& debug_name) = 0;
64 virtual scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
65 int frame_id) = 0;
66 virtual gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl*
67 CreateOffscreenGraphicsContext3D(
68 const blink::WebGraphicsContext3D::Attributes& attributes) = 0;
70 protected:
71 SynchronousCompositorFactory() {}
72 virtual ~SynchronousCompositorFactory() {}
77 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_