| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ | |
| 6 #define CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ | |
| 7 | |
| 8 #include "cc/surfaces/display_client.h" | |
| 9 | |
| 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" | |
| 16 | |
| 17 namespace cc { | |
| 18 class ContextProvider; | |
| 19 class SurfaceManager; | |
| 20 class SurfaceDisplayOutputSurface; | |
| 21 | |
| 22 // This class provides a DisplayClient implementation for drawing directly to an | |
| 23 // onscreen context. | |
| 24 class CC_SURFACES_EXPORT OnscreenDisplayClient | |
| 25 : NON_EXPORTED_BASE(DisplayClient) { | |
| 26 public: | |
| 27 OnscreenDisplayClient( | |
| 28 scoped_ptr<OutputSurface> output_surface, | |
| 29 SurfaceManager* manager, | |
| 30 SharedBitmapManager* bitmap_manager, | |
| 31 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 32 const RendererSettings& settings, | |
| 33 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | |
| 34 ~OnscreenDisplayClient() override; | |
| 35 | |
| 36 bool Initialize(); | |
| 37 Display* display() { return display_.get(); } | |
| 38 void set_surface_output_surface(SurfaceDisplayOutputSurface* surface) { | |
| 39 surface_display_output_surface_ = surface; | |
| 40 } | |
| 41 | |
| 42 // DisplayClient implementation. | |
| 43 void DisplayDamaged() override; | |
| 44 void DidSwapBuffers() override; | |
| 45 void DidSwapBuffersComplete() override; | |
| 46 void CommitVSyncParameters(base::TimeTicks timebase, | |
| 47 base::TimeDelta interval) override; | |
| 48 void OutputSurfaceLost() override; | |
| 49 | |
| 50 bool output_surface_lost() { return output_surface_lost_; } | |
| 51 | |
| 52 private: | |
| 53 void ScheduleDraw(); | |
| 54 void Draw(); | |
| 55 | |
| 56 scoped_ptr<OutputSurface> output_surface_; | |
| 57 scoped_ptr<Display> display_; | |
| 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 59 SurfaceDisplayOutputSurface* surface_display_output_surface_; | |
| 60 bool scheduled_draw_; | |
| 61 bool output_surface_lost_; | |
| 62 // True if a draw should be scheduled, but it's hit the limit on max frames | |
| 63 // pending. | |
| 64 bool deferred_draw_; | |
| 65 int pending_frames_; | |
| 66 | |
| 67 base::WeakPtrFactory<OnscreenDisplayClient> weak_ptr_factory_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); | |
| 70 }; | |
| 71 | |
| 72 } // namespace cc | |
| 73 | |
| 74 #endif // CC_SURFACES_ONSCREEN_DISPLAY_CLIENT_H_ | |
| OLD | NEW |