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