| OLD | NEW |
| 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 "cc/surfaces/display.h" | 13 #include "cc/surfaces/display.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 class ContextProvider; | 16 class ContextProvider; |
| 16 class SurfaceManager; | 17 class SurfaceManager; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // This class provides a DisplayClient implementation for drawing directly to an | 22 // This class provides a DisplayClient implementation for drawing directly to an |
| 22 // onscreen context. | 23 // onscreen context. |
| 23 class OnscreenDisplayClient : cc::DisplayClient { | 24 class OnscreenDisplayClient : cc::DisplayClient { |
| 24 public: | 25 public: |
| 25 OnscreenDisplayClient( | 26 OnscreenDisplayClient( |
| 26 const scoped_refptr<cc::ContextProvider>& onscreen_context_provider, | 27 const scoped_refptr<cc::ContextProvider>& onscreen_context_provider, |
| 27 scoped_ptr<cc::OutputSurface> software_surface, | 28 scoped_ptr<cc::OutputSurface> software_surface, |
| 28 cc::SurfaceManager* manager); | 29 cc::SurfaceManager* manager, |
| 30 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 29 virtual ~OnscreenDisplayClient(); | 31 virtual ~OnscreenDisplayClient(); |
| 30 | 32 |
| 31 cc::Display* display() { return display_.get(); } | 33 cc::Display* display() { return display_.get(); } |
| 32 | 34 |
| 33 // cc::DisplayClient implementation. | 35 // cc::DisplayClient implementation. |
| 34 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; | 36 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface() OVERRIDE; |
| 37 virtual void DisplayDamaged() OVERRIDE; |
| 35 | 38 |
| 36 private: | 39 private: |
| 40 void Draw(); |
| 41 |
| 37 scoped_refptr<cc::ContextProvider> onscreen_context_provider_; | 42 scoped_refptr<cc::ContextProvider> onscreen_context_provider_; |
| 38 scoped_ptr<cc::OutputSurface> software_surface_; | 43 scoped_ptr<cc::OutputSurface> software_surface_; |
| 39 scoped_ptr<cc::Display> display_; | 44 scoped_ptr<cc::Display> display_; |
| 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 46 bool scheduled_draw_; |
| 47 |
| 48 base::WeakPtrFactory<OnscreenDisplayClient> weak_ptr_factory_; |
| 40 | 49 |
| 41 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); | 50 DISALLOW_COPY_AND_ASSIGN(OnscreenDisplayClient); |
| 42 }; | 51 }; |
| 43 | 52 |
| 44 } // namespace content | 53 } // namespace content |
| 45 | 54 |
| 46 #endif // CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_ | 55 #endif // CONTENT_BROWSER_COMPOSITOR_ONSCREEN_DISPLAY_CLIENT_H_ |
| OLD | NEW |