Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: cc/surfaces/onscreen_display_client.h

Issue 1138563002: Add DisplayScheduler for Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rendererLatencyRecoveryHeuristic
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/onscreen_display_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ 5 #ifndef CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_
6 #define CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ 6 #define CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_
7 7
8 #include "cc/surfaces/display_client.h" 8 #include "cc/surfaces/display_client.h"
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "cc/surfaces/display.h" 14 #include "cc/surfaces/display.h"
15 #include "cc/surfaces/surfaces_export.h" 15 #include "cc/surfaces/surfaces_export.h"
16 16
17 namespace cc { 17 namespace cc {
18 class ContextProvider; 18 class ContextProvider;
19 class DisplayScheduler;
19 class SurfaceManager; 20 class SurfaceManager;
20 class SurfaceDisplayOutputSurface; 21 class SurfaceDisplayOutputSurface;
22 class SyntheticBeginFrameSource;
21 23
22 // This class provides a DisplayClient implementation for drawing directly to an 24 // This class provides a DisplayClient implementation for drawing directly to an
23 // onscreen context. 25 // onscreen context.
24 class CC_SURFACES_EXPORT OnscreenDisplayClient 26 class CC_SURFACES_EXPORT OnscreenDisplayClient
25 : NON_EXPORTED_BASE(DisplayClient) { 27 : NON_EXPORTED_BASE(DisplayClient) {
26 public: 28 public:
27 OnscreenDisplayClient( 29 OnscreenDisplayClient(
28 scoped_ptr<OutputSurface> output_surface, 30 scoped_ptr<OutputSurface> output_surface,
29 SurfaceManager* manager, 31 SurfaceManager* manager,
30 SharedBitmapManager* bitmap_manager, 32 SharedBitmapManager* bitmap_manager,
31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 33 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
32 const RendererSettings& settings, 34 const RendererSettings& settings,
33 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 35 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
34 ~OnscreenDisplayClient() override; 36 ~OnscreenDisplayClient() override;
35 37
36 bool Initialize(); 38 bool Initialize();
37 Display* display() { return display_.get(); } 39 Display* display() { return display_.get(); }
38 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { 40 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) {
39 surface_display_output_surface_ = surface; 41 surface_display_output_surface_ = surface;
40 } 42 }
41 43
42 // DisplayClient implementation. 44 // DisplayClient implementation.
43 void DisplayDamaged() override;
44 void DidSwapBuffers() override;
45 void DidSwapBuffersComplete() override;
46 void CommitVSyncParameters(base::TimeTicks timebase, 45 void CommitVSyncParameters(base::TimeTicks timebase,
47 base::TimeDelta interval) override; 46 base::TimeDelta interval) override;
48 void OutputSurfaceLost() override; 47 void OutputSurfaceLost() override;
49 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; 48 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
50 49
51 bool output_surface_lost() { return output_surface_lost_; } 50 bool output_surface_lost() { return output_surface_lost_; }
52 51
53 private:
54 void ScheduleDraw();
55 void Draw();
56
57 protected: 52 protected:
58 scoped_ptr<OutputSurface> output_surface_; 53 scoped_ptr<OutputSurface> output_surface_;
59 scoped_ptr<Display> display_; 54 scoped_ptr<Display> display_;
55 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_;
56 scoped_ptr<DisplayScheduler> scheduler_;
60 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 57 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
61 SurfaceDisplayOutputSurface* surface_display_output_surface_; 58 SurfaceDisplayOutputSurface* surface_display_output_surface_;
62 bool scheduled_draw_;
63 bool output_surface_lost_; 59 bool output_surface_lost_;
64 // True if a draw should be scheduled, but it's hit the limit on max frames
65 // pending.
66 bool deferred_draw_;
67 int pending_frames_;
68
69 base::WeakPtrFactory<OnscreenDisplayClient> weak_ptr_factory_;
70 60
71 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); 61 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient);
72 }; 62 };
73 63
74 } // namespace cc 64 } // namespace cc
75 65
76 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ 66 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_
OLDNEW
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/onscreen_display_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698