Chromium Code Reviews| Index: components/view_manager/surfaces/surfaces_state.h |
| diff --git a/components/view_manager/surfaces/surfaces_state.h b/components/view_manager/surfaces/surfaces_state.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b6d1bf1030edaea4d6727055ad72a0626ca2f91d |
| --- /dev/null |
| +++ b/components/view_manager/surfaces/surfaces_state.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_VIEW_MANAGER_SURFACES_SURFACES_STATE_H_ |
| +#define COMPONENTS_VIEW_MANAGER_SURFACES_SURFACES_STATE_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "cc/surfaces/surface_manager.h" |
| +#include "components/view_manager/surfaces/surfaces_scheduler.h" |
| + |
| +namespace cc { |
| +class SurfaceManager; |
| +} // namespace cc |
| + |
| +namespace surfaces { |
| + |
| +// The SurfacesState object is an object global to the View Manager app that |
| +// holds the SurfaceManager, SurfacesScheduler and allocates new Surfaces |
| +// namespaces. |
|
rjkroege
2015/08/06 22:39:11
can you say what thread it lives on
Fady Samuel
2015/08/07 01:15:21
Done.
|
| +class SurfacesState : public base::RefCounted<SurfacesState> { |
|
rjkroege
2015/08/06 22:39:11
if it's only on one thread and you pass it around,
Fady Samuel
2015/08/07 01:15:21
It might be possible to get away with not doing th
|
| + public: |
| + SurfacesState(); |
| + |
| + uint32_t next_id_namespace() { return next_id_namespace_++; } |
| + |
| + cc::SurfaceManager* manager() { return &manager_; } |
| + |
| + SurfacesScheduler* scheduler() { return &scheduler_; } |
| + |
| + private: |
| + friend class base::RefCounted<SurfacesState>; |
| + ~SurfacesState(); |
| + |
| + // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated |
| + // by the Surfaces service, and the low 32-bits are generated by the process |
| + // that requested the Surface. |
| + uint32_t next_id_namespace_; |
| + cc::SurfaceManager manager_; |
| + SurfacesScheduler scheduler_; |
| +}; |
| + |
| +} // namespace surfaces |
| + |
| +#endif // COMPONENTS_VIEW_MANAGER_SURFACES_SURFACES_STATE_H_ |