~raof/mir/prober-drm-device-probe

« back to all changes in this revision

Viewing changes to src/server/frontend/session_mediator.cpp

  • Committer: Christopher James Halse Rogers
  • Date: 2013-07-01 07:32:26 UTC
  • mfrom: (761.1.32 trunk)
  • Revision ID: raof@ubuntu.com-20130701073226-vqc2vq8jhe98v1vh
Merge trunk, resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
{
62
62
}
63
63
 
 
64
mf::SessionMediator::~SessionMediator() noexcept
 
65
{
 
66
    if (session)
 
67
    {
 
68
        report->session_error(session->name(), __PRETTY_FUNCTION__, "connection dropped without disconnect");
 
69
        shell->close_session(session);
 
70
    }
 
71
}
 
72
 
64
73
void mf::SessionMediator::connect(
65
74
    ::google::protobuf::RpcController*,
66
75
    const ::mir::protobuf::ConnectParameters* request,
124
133
        if (surface->supports_input())
125
134
            response->add_fd(surface->client_input_fd());
126
135
 
127
 
        auto const& buffer_resource = surface->client_buffer();
128
 
 
129
 
        auto const& id = buffer_resource->id();
 
136
        client_buffer_resource = surface->advance_client_buffer();
 
137
        auto const& id = client_buffer_resource->id();
130
138
 
131
139
        auto buffer = response->mutable_buffer();
132
140
        buffer->set_buffer_id(id.as_uint32_t());
134
142
        if (!client_tracker->client_has(id))
135
143
        {
136
144
            auto packer = std::make_shared<mfd::ProtobufBufferPacker>(buffer);
137
 
            graphics_platform->fill_ipc_package(packer, buffer_resource);
138
 
 
139
 
            //TODO: (kdub) here, we should hold onto buffer_resource. so ms::Surface doesn't have
140
 
            // to worry about it. ms::Surface guarentees the resource will be there until the end
141
 
            // of the ipc request
 
145
            graphics_platform->fill_ipc_package(packer, client_buffer_resource);
142
146
        }
143
147
        client_tracker->add(id);
144
148
    }
159
163
 
160
164
    auto surface = session->get_surface(SurfaceId(request->value()));
161
165
 
162
 
    surface->advance_client_buffer();
163
 
    auto const& buffer_resource = surface->client_buffer();
164
 
    auto const& id = buffer_resource->id();
 
166
    client_buffer_resource.reset();
 
167
    client_buffer_resource = surface->advance_client_buffer();
 
168
 
 
169
    auto const& id = client_buffer_resource->id();
165
170
    response->set_buffer_id(id.as_uint32_t());
166
171
 
167
172
    if (!client_tracker->client_has(id))
168
173
    {
169
174
        auto packer = std::make_shared<mfd::ProtobufBufferPacker>(response);
170
 
        graphics_platform->fill_ipc_package(packer, buffer_resource);
171
 
 
172
 
        //TODO: (kdub) here, we should hold onto buffer_resource. so ms::Surface doesn't have
173
 
        // to worry about it. ms::Surface guarentees the resource will be there until the end
174
 
        // of the ipc request
 
175
        graphics_platform->fill_ipc_package(packer, client_buffer_resource);
175
176
    }
176
177
    client_tracker->add(id);
177
178
    done->Run();
237
238
 
238
239
    done->Run();
239
240
}
240