Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: webrtc/base/nethelpers.h

Issue 2915253002: Delete SignalThread class. (Closed)
Patch Set: Write the member variables for the result only on the |construction_thread_|. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/nethelpers.h
diff --git a/webrtc/base/nethelpers.h b/webrtc/base/nethelpers.h
index b0727f861b6a2910b225b839447e21d02911bc74..c5265942775e113d196a563653f32a7fd16aa1aa 100644
--- a/webrtc/base/nethelpers.h
+++ b/webrtc/base/nethelpers.h
@@ -21,17 +21,19 @@
#include <list>
#include "webrtc/base/asyncresolverinterface.h"
-#include "webrtc/base/signalthread.h"
+#include "webrtc/base/platform_thread.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/socketaddress.h"
namespace rtc {
-class AsyncResolverTest;
+class Thread;
-// AsyncResolver will perform async DNS resolution, signaling the result on
-// the SignalDone from AsyncResolverInterface when the operation completes.
-class AsyncResolver : public SignalThread, public AsyncResolverInterface {
+// AsyncResolver will perform async DNS resolution, signaling the result on the
+// SignalDone from AsyncResolverInterface when the operation completes.
+// SignalDone is fired on the same thread on which the AsyncResolver was
+// constructed.
+class AsyncResolver : public AsyncResolverInterface {
public:
AsyncResolver();
~AsyncResolver() override;
@@ -44,14 +46,18 @@ class AsyncResolver : public SignalThread, public AsyncResolverInterface {
const std::vector<IPAddress>& addresses() const { return addresses_; }
void set_error(int error) { error_ = error; }
- protected:
- void DoWork() override;
- void OnWorkDone() override;
-
private:
+ // Worker thread main function.
+ static void ThreadEntry_w(void* p);
+ void ResolveAddress_w();
+
+ void ResolveDone(int error, std::vector<IPAddress> addresses);
tommi 2017/06/15 10:20:32 passing by value intentionally? If so, a comment a
nisse-webrtc 2017/06/15 11:33:47 I was aiming to keep this as simple as possible, a
+
+ rtc::Thread* construction_thread_;
tommi 2017/06/15 10:20:32 rtc::Thread* const construction_thread_;
nisse-webrtc 2017/06/15 11:33:47 Done.
+ PlatformThread worker_;
tommi 2017/06/15 10:20:32 nit: resolve_thread_
nisse-webrtc 2017/06/15 11:33:47 Not doing this now, since I'll attempt to replace
SocketAddress addr_;
std::vector<IPAddress> addresses_;
- int error_;
+ int error_ = -1;
};
// rtc namespaced wrappers for inet_ntop and inet_pton so we can avoid
« no previous file with comments | « webrtc/base/BUILD.gn ('k') | webrtc/base/nethelpers.cc » ('j') | webrtc/base/nethelpers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698