Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / compositor / browser_compositor_output_surface.h
blobdd538769e7632a44207159fa1d18d9d6d2f02890
1 // Copyright 2014 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_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
8 #include "base/id_map.h"
9 #include "base/threading/non_thread_safe.h"
10 #include "cc/output/output_surface.h"
11 #include "content/common/content_export.h"
12 #include "ui/compositor/compositor_vsync_manager.h"
14 namespace cc {
15 class SoftwareOutputDevice;
18 namespace content {
19 class ContextProviderCommandBuffer;
20 class ReflectorImpl;
21 class WebGraphicsContext3DCommandBufferImpl;
23 class CONTENT_EXPORT BrowserCompositorOutputSurface
24 : public cc::OutputSurface,
25 public ui::CompositorVSyncManager::Observer,
26 public base::NonThreadSafe {
27 public:
28 ~BrowserCompositorOutputSurface() override;
30 // cc::OutputSurface implementation.
31 bool BindToClient(cc::OutputSurfaceClient* client) override;
33 // ui::CompositorOutputSurface::Observer implementation.
34 void OnUpdateVSyncParameters(base::TimeTicks timebase,
35 base::TimeDelta interval) override;
37 void OnUpdateVSyncParametersFromGpu(base::TimeTicks tiembase,
38 base::TimeDelta interval);
40 void SetReflector(ReflectorImpl* reflector);
42 #if defined(OS_MACOSX)
43 virtual void OnSurfaceDisplayed() = 0;
44 #endif
46 protected:
47 // Constructor used by the accelerated implementation.
48 BrowserCompositorOutputSurface(
49 const scoped_refptr<ContextProviderCommandBuffer>& context,
50 int surface_id,
51 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
52 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager);
54 // Constructor used by the software implementation.
55 BrowserCompositorOutputSurface(
56 scoped_ptr<cc::SoftwareOutputDevice> software_device,
57 int surface_id,
58 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
59 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager);
61 int surface_id_;
62 IDMap<BrowserCompositorOutputSurface>* output_surface_map_;
64 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_;
65 scoped_refptr<ReflectorImpl> reflector_;
67 private:
68 void Initialize();
70 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface);
73 } // namespace content
75 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_