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