| 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_SURFACES_STATE_H_ | 5 #ifndef SERVICES_UI_SURFACES_SURFACES_STATE_H_ |
| 6 #define SERVICES_UI_SURFACES_SURFACES_STATE_H_ | 6 #define SERVICES_UI_SURFACES_SURFACES_STATE_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 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 class SurfaceHittest; | 15 class SurfaceHittest; |
| 16 class SurfaceManager; | 16 class SurfaceManager; |
| 17 } // namespace cc | 17 } // namespace cc |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 // The SurfacesState object is an object global to the Window Manager app that | 21 // The SurfacesState object is an object global to the Window Manager app that |
| 22 // holds the SurfaceManager and allocates new Surfaces namespaces. | 22 // holds the SurfaceManager and allocates new Surfaces namespaces. |
| 23 // This object lives on the main thread of the Window Manager. | 23 // This object lives on the main thread of the Window Manager. |
| 24 // 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 |
| 25 // displays. | 25 // displays. |
| 26 class SurfacesState : public base::RefCounted<SurfacesState> { | 26 class SurfacesState : public base::RefCounted<SurfacesState> { |
| 27 public: | 27 public: |
| 28 SurfacesState(); | 28 SurfacesState(); |
| 29 | 29 |
| 30 uint32_t next_id_namespace() { return next_id_namespace_++; } | 30 uint32_t next_client_id() { return next_client_id_++; } |
| 31 | 31 |
| 32 cc::SurfaceManager* manager() { return &manager_; } | 32 cc::SurfaceManager* manager() { return &manager_; } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 friend class base::RefCounted<SurfacesState>; | 35 friend class base::RefCounted<SurfacesState>; |
| 36 ~SurfacesState(); | 36 ~SurfacesState(); |
| 37 | 37 |
| 38 // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated | 38 // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated |
| 39 // by the Surfaces service, and the low 32-bits are generated by the process | 39 // by the Surfaces service, and the low 32-bits are generated by the process |
| 40 // that requested the Surface. | 40 // that requested the Surface. |
| 41 uint32_t next_id_namespace_; | 41 uint32_t next_client_id_; |
| 42 cc::SurfaceManager manager_; | 42 cc::SurfaceManager manager_; |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(SurfacesState); | 44 DISALLOW_COPY_AND_ASSIGN(SurfacesState); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace ui | 47 } // namespace ui |
| 48 | 48 |
| 49 #endif // SERVICES_UI_SURFACES_SURFACES_STATE_H_ | 49 #endif // SERVICES_UI_SURFACES_SURFACES_STATE_H_ |
| OLD | NEW |