~vanvugt/mir/mir-display-config-header

« back to all changes in this revision

Viewing changes to src/server/report/logging/display_configuration_report.h

  • Committer: Tarmac
  • Author(s): Christopher James Halse Rogers
  • Date: 2016-11-15 23:48:01 UTC
  • mfrom: (3730.3.26 reports-as-observers)
  • Revision ID: tarmac-20161115234801-2w603k4v3ffhfl3u
Replace the mir::Server-overridable Reports with Observers.

This resolves two problems:
1) It ensures that Mir will respect the various reporting options we provide, even when the shell wants to hook into some of the reports, and
2) It matches the semantic expectations around Reports vs Observers that (most of) the Mir team have. A couple of report call-sites which are unsafe for Observers are fixed in this branch.

Approved by mir-ci-bot, Kevin DuBois, Andreas Pokorny, Cemil Azizoglu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef MIR_DISPLAYCONFIGURATIONREPORT_H
20
20
#define MIR_DISPLAYCONFIGURATIONREPORT_H
21
21
 
22
 
#include "mir/graphics/display_configuration_report.h"
 
22
#include "mir/graphics/display_configuration_observer.h"
23
23
 
24
24
#include <memory>
25
25
 
26
26
namespace mir
27
27
{
28
 
namespace logging { class Logger; }
 
28
namespace logging { class Logger; enum class Severity; }
29
29
 
30
30
namespace report
31
31
{
32
32
namespace logging
33
33
{
34
 
class DisplayConfigurationReport : public mir::graphics::DisplayConfigurationReport
 
34
class DisplayConfigurationReport : public mir::graphics::DisplayConfigurationObserver
35
35
{
36
36
public:
37
37
    DisplayConfigurationReport(std::shared_ptr<mir::logging::Logger> const& logger);
38
38
    ~DisplayConfigurationReport();
39
39
 
40
 
    virtual void initial_configuration(graphics::DisplayConfiguration const& configuration) override;
41
 
 
42
 
    virtual void new_configuration(graphics::DisplayConfiguration const& configuration) override;
 
40
    void configuration_applied(
 
41
        std::shared_ptr<graphics::DisplayConfiguration const> const& config) override;
 
42
 
 
43
    void configuration_failed(
 
44
        std::shared_ptr<graphics::DisplayConfiguration const> const& attempted,
 
45
        std::exception const& error) override;
 
46
 
 
47
    void initial_configuration(
 
48
        std::shared_ptr<graphics::DisplayConfiguration const> const& configuration) override;
 
49
 
 
50
    void catastrophic_configuration_error(
 
51
        std::shared_ptr<graphics::DisplayConfiguration const> const& failed_fallback,
 
52
        std::exception const& error) override;
43
53
 
44
54
private:
45
 
    void log_configuration(graphics::DisplayConfiguration const& configuration) const;
 
55
    void log_configuration(
 
56
        mir::logging::Severity severity,
 
57
        graphics::DisplayConfiguration const& configuration) const;
46
58
    std::shared_ptr<mir::logging::Logger> const logger;
47
59
};
48
60
}