Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / renderer / android / synchronous_compositor_factory.h
blobbb5eabb4f85fb5875af3bf11269c983063b6c998
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 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue) = 0;
55 // The factory maintains ownership of the returned interface.
56 virtual InputHandlerManagerClient* GetInputHandlerManagerClient() = 0;
58 virtual scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
59 int routing_id) = 0;
60 virtual scoped_refptr<StreamTextureFactory> CreateStreamTextureFactory(
61 int frame_id) = 0;
63 // Methods below should not be called if OverrideWithFactory is false.
64 // Instead, just fallback to default implementation, as if factory
65 // does not exist.
66 virtual bool OverrideWithFactory();
67 virtual scoped_refptr<cc_blink::ContextProviderWebContext>
68 CreateOffscreenContextProvider(
69 const blink::WebGraphicsContext3D::Attributes& attributes,
70 const std::string& debug_name) = 0;
71 virtual gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl*
72 CreateOffscreenGraphicsContext3D(
73 const blink::WebGraphicsContext3D::Attributes& attributes) = 0;
74 virtual gpu::GPUInfo GetGPUInfo() const = 0;
76 protected:
77 SynchronousCompositorFactory() {}
78 virtual ~SynchronousCompositorFactory() {}
83 #endif // CONTENT_RENDERER_ANDROID_SYNCHRONOUS_COMPOSITOR_FACTORY_H_