Chromium Code Reviews| Index: webrtc/examples/peerconnection/client/linux/main.cc |
| diff --git a/webrtc/examples/peerconnection/client/linux/main.cc b/webrtc/examples/peerconnection/client/linux/main.cc |
| index 2982c287f12beb4ee61072820fa1e825d588b9a2..7886f766f9003b245ac029746dc7f77d69c1164a 100644 |
| --- a/webrtc/examples/peerconnection/client/linux/main.cc |
| +++ b/webrtc/examples/peerconnection/client/linux/main.cc |
| @@ -20,10 +20,14 @@ |
| class CustomSocketServer : public rtc::PhysicalSocketServer { |
| public: |
| - CustomSocketServer(rtc::Thread* thread, GtkMainWnd* wnd) |
| - : thread_(thread), wnd_(wnd), conductor_(NULL), client_(NULL) {} |
| + explicit CustomSocketServer(GtkMainWnd* wnd) |
| + : wnd_(wnd), conductor_(NULL), client_(NULL) {} |
| virtual ~CustomSocketServer() {} |
| + void SetMessageQueue(rtc::MessageQueue* queue) override { |
| + message_queue_ = queue; |
| + } |
| + |
| void set_client(PeerConnectionClient* client) { client_ = client; } |
| void set_conductor(Conductor* conductor) { conductor_ = conductor; } |
| @@ -39,14 +43,14 @@ class CustomSocketServer : public rtc::PhysicalSocketServer { |
| if (!wnd_->IsWindow() && !conductor_->connection_active() && |
| client_ != NULL && !client_->is_connected()) { |
| - thread_->Quit(); |
| + message_queue_->Quit(); |
| } |
| return rtc::PhysicalSocketServer::Wait(0/*cms == -1 ? 1 : cms*/, |
| process_io); |
| } |
| protected: |
| - rtc::Thread* thread_; |
| + rtc::MessageQueue* message_queue_; |
| GtkMainWnd* wnd_; |
| Conductor* conductor_; |
| PeerConnectionClient* client_; |
| @@ -81,10 +85,8 @@ int main(int argc, char* argv[]) { |
| GtkMainWnd wnd(FLAG_server, FLAG_port, FLAG_autoconnect, FLAG_autocall); |
| wnd.Create(); |
| - rtc::AutoThread auto_thread; |
| - rtc::Thread* thread = rtc::Thread::Current(); |
| - CustomSocketServer socket_server(thread, &wnd); |
| - thread->set_socketserver(&socket_server); |
| + CustomSocketServer socket_server(&wnd); |
| + rtc::AutoSocketServerThread thread(&socket_server); |
|
Taylor Brandstetter
2017/04/28 02:59:34
Do you need to call SetMessageQueue here?
nisse-webrtc
2017/04/28 09:46:52
I don't think so, I hope that's taken care of by t
Taylor Brandstetter
2017/04/28 16:59:45
Ah, I didn't notice it was a SocketServer override
|
| rtc::InitializeSSL(); |
| // Must be constructed after we set the socketserver. |
| @@ -94,12 +96,11 @@ int main(int argc, char* argv[]) { |
| socket_server.set_client(&client); |
| socket_server.set_conductor(conductor); |
| - thread->Run(); |
| + thread.Run(); |
| // gtk_main(); |
| wnd.Destroy(); |
| - thread->set_socketserver(NULL); |
| // TODO(henrike): Run the Gtk main loop to tear down the connection. |
| /* |
| while (gtk_events_pending()) { |