Wrapper script for isolating telemetry_gpu_unittests.
[chromium-blink-merge.git] / cc / surfaces / onscreen_display_client.h
blob4c4245d4161eb3e04120f582ce04fed82c8a3872
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 CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_
6 #define CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_
8 #include "cc/surfaces/display_client.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/single_thread_task_runner.h"
14 #include "cc/surfaces/display.h"
15 #include "cc/surfaces/surfaces_export.h"
17 class VSyncParameterObserver;
19 namespace cc {
20 class BeginFrameSource;
21 class ContextProvider;
22 class DisplayScheduler;
23 class SurfaceManager;
24 class SurfaceDisplayOutputSurface;
26 // This class provides a DisplayClient implementation for drawing directly to an
27 // onscreen context.
28 class CC_SURFACES_EXPORT OnscreenDisplayClient
29 : NON_EXPORTED_BASE(DisplayClient) {
30 public:
31 OnscreenDisplayClient(
32 scoped_ptr<OutputSurface> output_surface,
33 SurfaceManager* manager,
34 SharedBitmapManager* bitmap_manager,
35 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
36 const RendererSettings& settings,
37 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
38 ~OnscreenDisplayClient() override;
40 bool Initialize();
41 Display* display() { return display_.get(); }
42 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) {
43 surface_display_output_surface_ = surface;
46 // DisplayClient implementation.
47 void CommitVSyncParameters(base::TimeTicks timebase,
48 base::TimeDelta interval) override;
49 void OutputSurfaceLost() override;
50 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
52 bool output_surface_lost() { return output_surface_lost_; }
54 protected:
55 scoped_ptr<OutputSurface> output_surface_;
56 scoped_ptr<Display> display_;
57 scoped_ptr<SyntheticBeginFrameSource> synthetic_frame_source_;
58 scoped_ptr<BackToBackBeginFrameSource> unthrottled_frame_source_;
59 scoped_ptr<DisplayScheduler> scheduler_;
60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
61 SurfaceDisplayOutputSurface* surface_display_output_surface_;
62 bool output_surface_lost_;
63 bool disable_display_vsync_;
65 private:
66 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient);
69 } // namespace cc
71 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_