~brandontschaefer/+junk/trunk-mir

« back to all changes in this revision

Viewing changes to include/platform/mir/graphics/platform.h

  • Committer: Alberto Aguirre
  • Author(s): Andreas Pokorny
  • Date: 2015-11-02 18:52:36 UTC
  • mfrom: (3069.1.1 switch-to-module-ptr)
  • Revision ID: alberto.aguirre@canonical.com-20151102185236-37wz1b3hvgd7zm7j
Switch to UniqueModulePtr in graphics platform creation symbols

With this the lifetime of the graphics platform shared module is tied to the lifetime of the graphics::Platform instance used by the server. So we can get rid of the global static SharedLibrary in mirserver. This is then identical to the lifetime tracking used for input platforms.

The platform plays factory for Display, PlatformIPCOperations and GraphicsBufferAllocator. These instances are still created as plain shared ptrs. Currently DisplayServer guarantees that the Platform outlives those objects, if we dont want to guarantee that destruction ordering we could also use UniqueModulePtr for those - but that requires a slightly larger rework in integration tests.

This change also required removing enable_shared_from_this from the kms version of mir::graphics::mesa::Platform. Capturing a UniqueModulePtr<T> with a shared_ptr<T> works, and also when enable_shared_from_this is used in T. It does not work when enable_shared_from_this is only added by a class derived from T.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include <boost/program_options/options_description.hpp>
24
24
#include <EGL/egl.h>
25
 
#include <memory>
26
25
 
27
26
#include "mir/module_properties.h"
 
27
#include "mir/module_deleter.h"
28
28
 
29
29
namespace mir
30
30
{
114
114
                         */
115
115
};
116
116
 
117
 
typedef std::shared_ptr<mir::graphics::Platform>(*CreateHostPlatform)(
 
117
typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateHostPlatform)(
118
118
    std::shared_ptr<mir::options::Option> const& options,
119
119
    std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
120
120
    std::shared_ptr<mir::graphics::DisplayReport> const& report);
121
121
 
122
 
typedef std::shared_ptr<mir::graphics::Platform>(*CreateGuestPlatform)(
 
122
typedef mir::UniqueModulePtr<mir::graphics::Platform>(*CreateGuestPlatform)(
123
123
    std::shared_ptr<mir::graphics::DisplayReport> const& report,
124
124
    std::shared_ptr<mir::graphics::NestedContext> const& nested_context);
125
125
 
148
148
 *
149
149
 * \ingroup platform_enablement
150
150
 */
151
 
std::shared_ptr<mir::graphics::Platform> create_host_platform(
 
151
mir::UniqueModulePtr<mir::graphics::Platform> create_host_platform(
152
152
    std::shared_ptr<mir::options::Option> const& options,
153
153
    std::shared_ptr<mir::EmergencyCleanupRegistry> const& emergency_cleanup_registry,
154
154
    std::shared_ptr<mir::graphics::DisplayReport> const& report);
164
164
 *
165
165
 * \ingroup platform_enablement
166
166
 */
167
 
std::shared_ptr<mir::graphics::Platform> create_guest_platform(
 
167
mir::UniqueModulePtr<mir::graphics::Platform> create_guest_platform(
168
168
    std::shared_ptr<mir::graphics::DisplayReport> const& report,
169
169
    std::shared_ptr<mir::graphics::NestedContext> const& nested_context);
170
170