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

Side by Side Diff: content/browser/compositor/onscreen_display_client.h

Issue 720333005: Add DisplayScheduler to enable BeginFrame-based scheduling of surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
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 CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_
6 #define CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_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/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "cc/surfaces/display.h" 13 #include "cc/surfaces/display.h"
14 14
15 namespace cc { 15 namespace cc {
16 class ContextProvider; 16 class ContextProvider;
17 class DisplayScheduler;
17 class SurfaceManager; 18 class SurfaceManager;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 class SurfaceDisplayOutputSurface; 22 class SurfaceDisplayOutputSurface;
22 23
23 // This class provides a DisplayClient implementation for drawing directly to an 24 // This class provides a DisplayClient implementation for drawing directly to an
24 // onscreen context. 25 // onscreen context.
25 class OnscreenDisplayClient : cc::DisplayClient { 26 class OnscreenDisplayClient : cc::DisplayClient {
26 public: 27 public:
27 OnscreenDisplayClient( 28 OnscreenDisplayClient(
28 scoped_ptr<cc::OutputSurface> output_surface, 29 scoped_ptr<cc::OutputSurface> output_surface,
29 cc::SurfaceManager* manager, 30 cc::SurfaceManager* manager,
30 scoped_refptr<base::SingleThreadTaskRunner> task_runner); 31 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
31 ~OnscreenDisplayClient() override; 32 ~OnscreenDisplayClient() override;
32 33
33 bool Initialize(); 34 bool Initialize();
34 cc::Display* display() { return display_.get(); } 35 cc::Display* display() { return display_.get(); }
35 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { 36 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) {
36 surface_display_output_surface_ = surface; 37 surface_display_output_surface_ = surface;
37 } 38 }
38 39
39 // cc::DisplayClient implementation. 40 // cc::DisplayClient implementation.
40 void DisplayDamaged() override;
41 void DidSwapBuffers() override;
42 void DidSwapBuffersComplete() override;
43 void CommitVSyncParameters(base::TimeTicks timebase, 41 void CommitVSyncParameters(base::TimeTicks timebase,
44 base::TimeDelta interval) override; 42 base::TimeDelta interval) override;
45 void OutputSurfaceLost() override; 43 void OutputSurfaceLost() override;
46 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; 44 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
47 45
48 private: 46 private:
49 void ScheduleDraw();
50 void Draw();
51
52 scoped_ptr<cc::OutputSurface> output_surface_; 47 scoped_ptr<cc::OutputSurface> output_surface_;
53 scoped_ptr<cc::Display> display_; 48 scoped_ptr<cc::Display> display_;
49 scoped_ptr<cc::DisplayScheduler> scheduler_;
54 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 50 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
55 SurfaceDisplayOutputSurface* surface_display_output_surface_; 51 SurfaceDisplayOutputSurface* surface_display_output_surface_;
56 bool scheduled_draw_;
57 bool output_surface_lost_;
58 // True if a draw should be scheduled, but it's hit the limit on max frames
59 // pending.
60 bool deferred_draw_;
61 int pending_frames_;
62
63 base::WeakPtrFactory<OnscreenDisplayClient> weak_ptr_factory_;
64 52
65 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); 53 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient);
66 }; 54 };
67 55
68 } // namespace content 56 } // namespace content
69 57
70 #endif // CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_ 58 #endif // CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698