Fix invalid cast in AppCacheGroup::AddUpdateObserver.
[chromium-blink-merge.git] / content / renderer / android / synchronous_compositor_factory.h
blobb670f9730cdfc3e8ee9e790e644a5ff8321454d6
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 "gpu/config/gpu_info.h"
11 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
13 namespace base {
14 class SingleThreadTaskRunner;
17 namespace cc {
18 class BeginFrameSource;
19 class ContextProvider;
20 class OutputSurface;
23 namespace cc_blink {
24 class ContextProviderWebContext;
27 namespace gpu_blink {
28 class WebGraphicsContext3DInProcessCommandBufferImpl;
31 namespace content {
33 class InputHandlerManagerClient;
34 class StreamTextureFactory;
35 class FrameSwapMessageQueue;
37 // Decouples creation from usage of the parts needed for the synchonous
38 // compositor rendering path. In practice this is only used in single
39 // process mode (namely, for Android WebView) hence the implementation of
40 // this will be injected from the logical 'browser' side code.
41 class SynchronousCompositorFactory {
42 public:
43 // Must only be called once, e.g. on startup. Ownership of |instance| remains
44 // with the caller.
45 static void SetInstance(SynchronousCompositorFactory* instance);
46 static SynchronousCompositorFactory* GetInstance();
48 virtual scoped_refptr<base::SingleThreadTaskRunner>
49 GetCompositorTaskRunner() = 0;
50 virtual bool RecordFullLayer() = 0;
51 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(
52 int routing_id,
53 int surface_id,
54 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) = 0;
56 // The factory maintains ownership of the returned interface.
57 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
59 virtual scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
60 int routing_id) = 0;
61 virtual scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
62 int frame_id) = 0;
64 // Methods below should not be called if OverrideWithFactory is false.
65 // Instead, just fallback to default implementation, as if factory
66 // does not exist.
67 virtual bool OverrideWithFactory() = 0;
68 virtual scoped_refptr<cc_blink::ContextProviderWebContext>
69 CreateOffscreenContextProvider(
70 const blink::WebGraphicsContext3D::Attributes& attributes,
71 const std::string& debug_name) = 0;
72 virtual gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl*
73 CreateOffscreenGraphicsContext3D(
74 const blink::WebGraphicsContext3D::Attributes& attributes) = 0;
75 virtual gpu::GPUInfo GetGPUInfo() const = 0;
77 protected:
78 SynchronousCompositorFactory() {}
79 virtual ~SynchronousCompositorFactory() {}
84 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_