| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 5 #ifndef SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "cc/surfaces/surface_manager.h" | 12 #include "cc/surfaces/surface_manager.h" |
| 13 #include "cc/surfaces/surface_observer.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 class SurfaceHittest; | 16 class SurfaceHittest; |
| 16 class SurfaceManager; | 17 class SurfaceManager; |
| 17 } // namespace cc | 18 } // namespace cc |
| 18 | 19 |
| 19 namespace ui { | 20 namespace ui { |
| 20 | 21 |
| 22 class DisplayCompositorClient; |
| 23 |
| 21 // The DisplayCompositor object is an object global to the Window Server app | 24 // The DisplayCompositor object is an object global to the Window Server app |
| 22 // that holds the SurfaceServer and allocates new Surfaces namespaces. | 25 // that holds the SurfaceServer and allocates new Surfaces namespaces. |
| 23 // This object lives on the main thread of the Window Server. | 26 // This object lives on the main thread of the Window Server. |
| 24 // TODO(rjkroege, fsamuel): This object will need to change to support multiple | 27 // TODO(rjkroege, fsamuel): This object will need to change to support multiple |
| 25 // displays. | 28 // displays. |
| 26 class DisplayCompositor : public base::RefCounted<DisplayCompositor> { | 29 class DisplayCompositor : public cc::SurfaceObserver, |
| 30 public base::RefCounted<DisplayCompositor> { |
| 27 public: | 31 public: |
| 28 DisplayCompositor(); | 32 explicit DisplayCompositor(DisplayCompositorClient* client); |
| 29 | 33 |
| 30 uint32_t GenerateNextClientId(); | 34 uint32_t GenerateNextClientId(); |
| 31 | 35 |
| 36 void ReturnSurfaceReference(const cc::SurfaceSequence& sequence); |
| 37 |
| 32 cc::SurfaceManager* manager() { return &manager_; } | 38 cc::SurfaceManager* manager() { return &manager_; } |
| 33 | 39 |
| 34 private: | 40 private: |
| 35 friend class base::RefCounted<DisplayCompositor>; | 41 friend class base::RefCounted<DisplayCompositor>; |
| 36 ~DisplayCompositor(); | 42 virtual ~DisplayCompositor(); |
| 37 | 43 |
| 38 // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated | 44 // cc::SurfaceObserver implementation. |
| 39 // by the Surfaces service, and the low 32-bits are generated by the process | 45 void OnSurfaceCreated(const cc::SurfaceId& surface_id, |
| 40 // that requested the Surface. | 46 const gfx::Size& frame_size, |
| 47 float device_scale_factor) override; |
| 48 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
| 49 bool* changed) override; |
| 50 |
| 51 DisplayCompositorClient* const client_; |
| 41 uint32_t next_client_id_; | 52 uint32_t next_client_id_; |
| 42 cc::SurfaceManager manager_; | 53 cc::SurfaceManager manager_; |
| 43 | 54 |
| 44 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 55 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
| 45 }; | 56 }; |
| 46 | 57 |
| 47 } // namespace ui | 58 } // namespace ui |
| 48 | 59 |
| 49 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 60 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
| OLD | NEW |