Fix clang style warnings in webrtc/base
Mostly this consists of marking functions with override when
applicable, and moving function bodies from .h to .cc files.
Not inlining virtual functions with simple bodies such as
{ return false; }
strikes me as probably losing more in readability than we gain in
binary size and compilation time, but I guess it's just like any other
case where enabling a generally good warning forces us to write
slightly worse code in a couple of places.
BUG=163
R=kjellander@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/47429004
Cr-Commit-Position: refs/heads/master@{#8656}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8656 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/LICENSE_THIRD_PARTY b/talk/LICENSE_THIRD_PARTY
index 0423fdb..50068ef 100644
--- a/talk/LICENSE_THIRD_PARTY
+++ b/talk/LICENSE_THIRD_PARTY
@@ -23,6 +23,7 @@
base/sha1.h
Governed by http://sigslot.sourceforge.net/#license (Public domain):
+base/sigslot.cc
base/sigslot.h
Governed by http://www.freedesktop.org/wiki/Software/systemd (LGPL 2.1+):
diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn
index 21235d3..ded5cdd 100644
--- a/webrtc/base/BUILD.gn
+++ b/webrtc/base/BUILD.gn
@@ -111,6 +111,7 @@
"exp_filter.h",
"md5.cc",
"md5.h",
+ "md5digest.cc",
"md5digest.h",
"platform_file.cc",
"platform_file.h",
@@ -158,6 +159,7 @@
"asyncfile.h",
"asynchttprequest.cc",
"asynchttprequest.h",
+ "asyncpacketsocket.cc",
"asyncpacketsocket.h",
"asyncsocket.cc",
"asyncsocket.h",
@@ -180,6 +182,7 @@
"crc32.cc",
"crc32.h",
"criticalsection.h",
+ "cryptstring.cc",
"cryptstring.h",
"diskcache.cc",
"diskcache.h",
@@ -235,9 +238,11 @@
"scoped_ptr.h",
"sha1.cc",
"sha1.h",
+ "sha1digest.cc",
"sha1digest.h",
"signalthread.cc",
"signalthread.h",
+ "sigslot.cc",
"sigslot.h",
"sigslotrepeater.h",
"socket.h",
@@ -317,6 +322,7 @@
"asyncinvoker.cc",
"asyncinvoker.h",
"asyncinvoker-inl.h",
+ "asyncresolverinterface.cc",
"asyncresolverinterface.h",
"atomicops.h",
"bandwidthsmoother.cc",
@@ -324,6 +330,7 @@
"basictypes.h",
"bind.h",
"bind.h.pump",
+ "buffer.cc",
"buffer.h",
"callback.h",
"callback.h.pump",
@@ -438,12 +445,6 @@
}
} # !build_with_chromium
- if (is_clang) {
- # Suppress warnings from the Chrome Clang plugins.
- # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
- configs -= [ "//build/config/clang:find_bad_constructs" ]
- }
-
# TODO(henrike): issue 3307, make rtc_base build with the Chromium default
# compiler settings.
configs -= [ "//build/config/compiler:chromium_code" ]
diff --git a/webrtc/base/asynchttprequest.h b/webrtc/base/asynchttprequest.h
index b8d13db..b4bbf25 100644
--- a/webrtc/base/asynchttprequest.h
+++ b/webrtc/base/asynchttprequest.h
@@ -31,7 +31,7 @@
class AsyncHttpRequest : public SignalThread {
public:
explicit AsyncHttpRequest(const std::string &user_agent);
- ~AsyncHttpRequest();
+ ~AsyncHttpRequest() override;
// If start_delay is less than or equal to zero, this starts immediately.
// Start_delay defaults to zero.
@@ -75,11 +75,11 @@
protected:
void set_error(HttpErrorType error) { error_ = error; }
- virtual void OnWorkStart();
- virtual void OnWorkStop();
+ void OnWorkStart() override;
+ void OnWorkStop() override;
void OnComplete(HttpClient* client, HttpErrorType error);
- virtual void OnMessage(Message* message);
- virtual void DoWork();
+ void OnMessage(Message* message) override;
+ void DoWork() override;
private:
void LaunchRequest();
diff --git a/webrtc/base/asyncinvoker-inl.h b/webrtc/base/asyncinvoker-inl.h
index e208ee9..f615f83 100644
--- a/webrtc/base/asyncinvoker-inl.h
+++ b/webrtc/base/asyncinvoker-inl.h
@@ -33,7 +33,7 @@
// thread if needed. Should be called from the target thread.
virtual void Execute() = 0;
protected:
- virtual ~AsyncClosure() {}
+ ~AsyncClosure() override {}
};
// Simple closure that doesn't trigger a callback for the calling thread.
@@ -55,7 +55,7 @@
class NotifyingAsyncClosureBase : public AsyncClosure,
public sigslot::has_slots<> {
public:
- virtual ~NotifyingAsyncClosureBase() { disconnect_all(); }
+ ~NotifyingAsyncClosureBase() override;
protected:
NotifyingAsyncClosureBase(AsyncInvoker* invoker, Thread* calling_thread);
diff --git a/webrtc/base/asyncinvoker.cc b/webrtc/base/asyncinvoker.cc
index 3ccdc4b..0488734 100644
--- a/webrtc/base/asyncinvoker.cc
+++ b/webrtc/base/asyncinvoker.cc
@@ -71,6 +71,10 @@
this, &NotifyingAsyncClosureBase::CancelCallback);
}
+NotifyingAsyncClosureBase::~NotifyingAsyncClosureBase() {
+ disconnect_all();
+}
+
void NotifyingAsyncClosureBase::TriggerCallback() {
CritScope cs(&crit_);
if (!CallbackCanceled() && !callback_.empty()) {
diff --git a/webrtc/base/asyncinvoker.h b/webrtc/base/asyncinvoker.h
index e4591a1..6e298e6 100644
--- a/webrtc/base/asyncinvoker.h
+++ b/webrtc/base/asyncinvoker.h
@@ -69,7 +69,7 @@
class AsyncInvoker : public MessageHandler {
public:
AsyncInvoker();
- virtual ~AsyncInvoker();
+ ~AsyncInvoker() override;
// Call |functor| asynchronously on |thread|, with no callback upon
// completion. Returns immediately.
@@ -120,7 +120,7 @@
sigslot::signal0<> SignalInvokerDestroyed;
private:
- virtual void OnMessage(Message* msg);
+ void OnMessage(Message* msg) override;
void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure,
uint32 id);
diff --git a/webrtc/base/asyncpacketsocket.cc b/webrtc/base/asyncpacketsocket.cc
new file mode 100644
index 0000000..fe36401
--- /dev/null
+++ b/webrtc/base/asyncpacketsocket.cc
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/asyncpacketsocket.h"
+
+namespace rtc {
+
+PacketTimeUpdateParams::PacketTimeUpdateParams()
+ : rtp_sendtime_extension_id(-1),
+ srtp_auth_tag_len(-1),
+ srtp_packet_index(-1) {
+}
+
+PacketTimeUpdateParams::~PacketTimeUpdateParams() = default;
+
+AsyncPacketSocket::AsyncPacketSocket() {
+}
+
+AsyncPacketSocket::~AsyncPacketSocket() {
+}
+
+}; // namespace rtc
diff --git a/webrtc/base/asyncpacketsocket.h b/webrtc/base/asyncpacketsocket.h
index dd91ea1..8054155 100644
--- a/webrtc/base/asyncpacketsocket.h
+++ b/webrtc/base/asyncpacketsocket.h
@@ -22,10 +22,8 @@
// extension, including the information needed to update the authentication tag
// after changing the value.
struct PacketTimeUpdateParams {
- PacketTimeUpdateParams()
- : rtp_sendtime_extension_id(-1), srtp_auth_tag_len(-1),
- srtp_packet_index(-1) {
- }
+ PacketTimeUpdateParams();
+ ~PacketTimeUpdateParams();
int rtp_sendtime_extension_id; // extension header id present in packet.
std::vector<char> srtp_auth_key; // Authentication key.
@@ -75,8 +73,8 @@
STATE_CONNECTED
};
- AsyncPacketSocket() { }
- virtual ~AsyncPacketSocket() { }
+ AsyncPacketSocket();
+ ~AsyncPacketSocket() override;
// Returns current local address. Address may be set to NULL if the
// socket is not bound yet (GetState() returns STATE_BINDING).
diff --git a/webrtc/base/asyncresolverinterface.cc b/webrtc/base/asyncresolverinterface.cc
new file mode 100644
index 0000000..7ee02f1
--- /dev/null
+++ b/webrtc/base/asyncresolverinterface.cc
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/asyncresolverinterface.h"
+
+namespace rtc {
+
+AsyncResolverInterface::AsyncResolverInterface() {
+}
+
+AsyncResolverInterface::~AsyncResolverInterface() = default;
+
+}; // namespace rtc
diff --git a/webrtc/base/asyncresolverinterface.h b/webrtc/base/asyncresolverinterface.h
index 4b401bd..75c36ab 100644
--- a/webrtc/base/asyncresolverinterface.h
+++ b/webrtc/base/asyncresolverinterface.h
@@ -19,8 +19,8 @@
// This interface defines the methods to resolve the address asynchronously.
class AsyncResolverInterface {
public:
- AsyncResolverInterface() {}
- virtual ~AsyncResolverInterface() {}
+ AsyncResolverInterface();
+ virtual ~AsyncResolverInterface();
// Start address resolve process.
virtual void Start(const SocketAddress& addr) = 0;
diff --git a/webrtc/base/asyncsocket.cc b/webrtc/base/asyncsocket.cc
index d565c6e..dc0de3d 100644
--- a/webrtc/base/asyncsocket.cc
+++ b/webrtc/base/asyncsocket.cc
@@ -31,14 +31,97 @@
socket_ = socket;
if (socket_) {
socket_->SignalConnectEvent.connect(this,
- &AsyncSocketAdapter::OnConnectEvent);
- socket_->SignalReadEvent.connect(this,
- &AsyncSocketAdapter::OnReadEvent);
- socket_->SignalWriteEvent.connect(this,
- &AsyncSocketAdapter::OnWriteEvent);
- socket_->SignalCloseEvent.connect(this,
- &AsyncSocketAdapter::OnCloseEvent);
+ &AsyncSocketAdapter::OnConnectEvent);
+ socket_->SignalReadEvent.connect(this, &AsyncSocketAdapter::OnReadEvent);
+ socket_->SignalWriteEvent.connect(this, &AsyncSocketAdapter::OnWriteEvent);
+ socket_->SignalCloseEvent.connect(this, &AsyncSocketAdapter::OnCloseEvent);
}
}
+SocketAddress AsyncSocketAdapter::GetLocalAddress() const {
+ return socket_->GetLocalAddress();
+}
+
+SocketAddress AsyncSocketAdapter::GetRemoteAddress() const {
+ return socket_->GetRemoteAddress();
+}
+
+int AsyncSocketAdapter::Bind(const SocketAddress& addr) {
+ return socket_->Bind(addr);
+}
+
+int AsyncSocketAdapter::Connect(const SocketAddress& addr) {
+ return socket_->Connect(addr);
+}
+
+int AsyncSocketAdapter::Send(const void* pv, size_t cb) {
+ return socket_->Send(pv, cb);
+}
+
+int AsyncSocketAdapter::SendTo(const void* pv,
+ size_t cb,
+ const SocketAddress& addr) {
+ return socket_->SendTo(pv, cb, addr);
+}
+
+int AsyncSocketAdapter::Recv(void* pv, size_t cb) {
+ return socket_->Recv(pv, cb);
+}
+
+int AsyncSocketAdapter::RecvFrom(void* pv, size_t cb, SocketAddress* paddr) {
+ return socket_->RecvFrom(pv, cb, paddr);
+}
+
+int AsyncSocketAdapter::Listen(int backlog) {
+ return socket_->Listen(backlog);
+}
+
+AsyncSocket* AsyncSocketAdapter::Accept(SocketAddress* paddr) {
+ return socket_->Accept(paddr);
+}
+
+int AsyncSocketAdapter::Close() {
+ return socket_->Close();
+}
+
+int AsyncSocketAdapter::GetError() const {
+ return socket_->GetError();
+}
+
+void AsyncSocketAdapter::SetError(int error) {
+ return socket_->SetError(error);
+}
+
+AsyncSocket::ConnState AsyncSocketAdapter::GetState() const {
+ return socket_->GetState();
+}
+
+int AsyncSocketAdapter::EstimateMTU(uint16* mtu) {
+ return socket_->EstimateMTU(mtu);
+}
+
+int AsyncSocketAdapter::GetOption(Option opt, int* value) {
+ return socket_->GetOption(opt, value);
+}
+
+int AsyncSocketAdapter::SetOption(Option opt, int value) {
+ return socket_->SetOption(opt, value);
+}
+
+void AsyncSocketAdapter::OnConnectEvent(AsyncSocket* socket) {
+ SignalConnectEvent(this);
+}
+
+void AsyncSocketAdapter::OnReadEvent(AsyncSocket* socket) {
+ SignalReadEvent(this);
+}
+
+void AsyncSocketAdapter::OnWriteEvent(AsyncSocket* socket) {
+ SignalWriteEvent(this);
+}
+
+void AsyncSocketAdapter::OnCloseEvent(AsyncSocket* socket, int err) {
+ SignalCloseEvent(this, err);
+}
+
} // namespace rtc
diff --git a/webrtc/base/asyncsocket.h b/webrtc/base/asyncsocket.h
index a6f3158..37bad4c 100644
--- a/webrtc/base/asyncsocket.h
+++ b/webrtc/base/asyncsocket.h
@@ -23,9 +23,9 @@
class AsyncSocket : public Socket {
public:
AsyncSocket();
- virtual ~AsyncSocket();
+ ~AsyncSocket() override;
- virtual AsyncSocket* Accept(SocketAddress* paddr) = 0;
+ AsyncSocket* Accept(SocketAddress* paddr) override = 0;
// SignalReadEvent and SignalWriteEvent use multi_threaded_local to allow
// access concurrently from different thread.
@@ -48,73 +48,31 @@
// that will be called during the detached period (usually GetState()), to
// avoid dereferencing a null pointer.
explicit AsyncSocketAdapter(AsyncSocket* socket);
- virtual ~AsyncSocketAdapter();
+ ~AsyncSocketAdapter() override;
void Attach(AsyncSocket* socket);
- virtual SocketAddress GetLocalAddress() const {
- return socket_->GetLocalAddress();
- }
- virtual SocketAddress GetRemoteAddress() const {
- return socket_->GetRemoteAddress();
- }
- virtual int Bind(const SocketAddress& addr) {
- return socket_->Bind(addr);
- }
- virtual int Connect(const SocketAddress& addr) {
- return socket_->Connect(addr);
- }
- virtual int Send(const void* pv, size_t cb) {
- return socket_->Send(pv, cb);
- }
- virtual int SendTo(const void* pv, size_t cb, const SocketAddress& addr) {
- return socket_->SendTo(pv, cb, addr);
- }
- virtual int Recv(void* pv, size_t cb) {
- return socket_->Recv(pv, cb);
- }
- virtual int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) {
- return socket_->RecvFrom(pv, cb, paddr);
- }
- virtual int Listen(int backlog) {
- return socket_->Listen(backlog);
- }
- virtual AsyncSocket* Accept(SocketAddress* paddr) {
- return socket_->Accept(paddr);
- }
- virtual int Close() {
- return socket_->Close();
- }
- virtual int GetError() const {
- return socket_->GetError();
- }
- virtual void SetError(int error) {
- return socket_->SetError(error);
- }
- virtual ConnState GetState() const {
- return socket_->GetState();
- }
- virtual int EstimateMTU(uint16* mtu) {
- return socket_->EstimateMTU(mtu);
- }
- virtual int GetOption(Option opt, int* value) {
- return socket_->GetOption(opt, value);
- }
- virtual int SetOption(Option opt, int value) {
- return socket_->SetOption(opt, value);
- }
+ SocketAddress GetLocalAddress() const override;
+ SocketAddress GetRemoteAddress() const override;
+ int Bind(const SocketAddress& addr) override;
+ int Connect(const SocketAddress& addr) override;
+ int Send(const void* pv, size_t cb) override;
+ int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
+ int Recv(void* pv, size_t cb) override;
+ int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override;
+ int Listen(int backlog) override;
+ AsyncSocket* Accept(SocketAddress* paddr) override;
+ int Close() override;
+ int GetError() const override;
+ void SetError(int error) override;
+ ConnState GetState() const override;
+ int EstimateMTU(uint16* mtu) override;
+ int GetOption(Option opt, int* value) override;
+ int SetOption(Option opt, int value) override;
protected:
- virtual void OnConnectEvent(AsyncSocket* socket) {
- SignalConnectEvent(this);
- }
- virtual void OnReadEvent(AsyncSocket* socket) {
- SignalReadEvent(this);
- }
- virtual void OnWriteEvent(AsyncSocket* socket) {
- SignalWriteEvent(this);
- }
- virtual void OnCloseEvent(AsyncSocket* socket, int err) {
- SignalCloseEvent(this, err);
- }
+ virtual void OnConnectEvent(AsyncSocket* socket);
+ virtual void OnReadEvent(AsyncSocket* socket);
+ virtual void OnWriteEvent(AsyncSocket* socket);
+ virtual void OnCloseEvent(AsyncSocket* socket, int err);
AsyncSocket* socket_;
};
diff --git a/webrtc/base/asynctcpsocket.h b/webrtc/base/asynctcpsocket.h
index ddee261..c50579d 100644
--- a/webrtc/base/asynctcpsocket.h
+++ b/webrtc/base/asynctcpsocket.h
@@ -23,26 +23,28 @@
class AsyncTCPSocketBase : public AsyncPacketSocket {
public:
AsyncTCPSocketBase(AsyncSocket* socket, bool listen, size_t max_packet_size);
- virtual ~AsyncTCPSocketBase();
+ ~AsyncTCPSocketBase() override;
// Pure virtual methods to send and recv data.
- virtual int Send(const void *pv, size_t cb,
- const rtc::PacketOptions& options) = 0;
+ int Send(const void *pv, size_t cb,
+ const rtc::PacketOptions& options) override = 0;
virtual void ProcessInput(char* data, size_t* len) = 0;
// Signals incoming connection.
virtual void HandleIncomingConnection(AsyncSocket* socket) = 0;
- virtual SocketAddress GetLocalAddress() const;
- virtual SocketAddress GetRemoteAddress() const;
- virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr,
- const rtc::PacketOptions& options);
- virtual int Close();
+ SocketAddress GetLocalAddress() const override;
+ SocketAddress GetRemoteAddress() const override;
+ int SendTo(const void* pv,
+ size_t cb,
+ const SocketAddress& addr,
+ const rtc::PacketOptions& options) override;
+ int Close() override;
- virtual State GetState() const;
- virtual int GetOption(Socket::Option opt, int* value);
- virtual int SetOption(Socket::Option opt, int value);
- virtual int GetError() const;
- virtual void SetError(int error);
+ State GetState() const override;
+ int GetOption(Socket::Option opt, int* value) override;
+ int SetOption(Socket::Option opt, int value) override;
+ int GetError() const override;
+ void SetError(int error) override;
protected:
// Binds and connects |socket| and creates AsyncTCPSocket for
@@ -84,12 +86,13 @@
const SocketAddress& bind_address,
const SocketAddress& remote_address);
AsyncTCPSocket(AsyncSocket* socket, bool listen);
- virtual ~AsyncTCPSocket() {}
+ ~AsyncTCPSocket() override {}
- virtual int Send(const void* pv, size_t cb,
- const rtc::PacketOptions& options);
- virtual void ProcessInput(char* data, size_t* len);
- virtual void HandleIncomingConnection(AsyncSocket* socket);
+ int Send(const void* pv,
+ size_t cb,
+ const rtc::PacketOptions& options) override;
+ void ProcessInput(char* data, size_t* len) override;
+ void HandleIncomingConnection(AsyncSocket* socket) override;
private:
DISALLOW_EVIL_CONSTRUCTORS(AsyncTCPSocket);
diff --git a/webrtc/base/asyncudpsocket.h b/webrtc/base/asyncudpsocket.h
index ac64dca..4b47007 100644
--- a/webrtc/base/asyncudpsocket.h
+++ b/webrtc/base/asyncudpsocket.h
@@ -31,21 +31,24 @@
static AsyncUDPSocket* Create(SocketFactory* factory,
const SocketAddress& bind_address);
explicit AsyncUDPSocket(AsyncSocket* socket);
- virtual ~AsyncUDPSocket();
+ ~AsyncUDPSocket() override;
- virtual SocketAddress GetLocalAddress() const;
- virtual SocketAddress GetRemoteAddress() const;
- virtual int Send(const void *pv, size_t cb,
- const rtc::PacketOptions& options);
- virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr,
- const rtc::PacketOptions& options);
- virtual int Close();
+ SocketAddress GetLocalAddress() const override;
+ SocketAddress GetRemoteAddress() const override;
+ int Send(const void* pv,
+ size_t cb,
+ const rtc::PacketOptions& options) override;
+ int SendTo(const void* pv,
+ size_t cb,
+ const SocketAddress& addr,
+ const rtc::PacketOptions& options) override;
+ int Close() override;
- virtual State GetState() const;
- virtual int GetOption(Socket::Option opt, int* value);
- virtual int SetOption(Socket::Option opt, int value);
- virtual int GetError() const;
- virtual void SetError(int error);
+ State GetState() const override;
+ int GetOption(Socket::Option opt, int* value) override;
+ int SetOption(Socket::Option opt, int value) override;
+ int GetError() const override;
+ void SetError(int error) override;
private:
// Called when the underlying socket is ready to be read from.
diff --git a/webrtc/base/autodetectproxy.cc b/webrtc/base/autodetectproxy.cc
index 8878d41..4ebc2d4 100644
--- a/webrtc/base/autodetectproxy.cc
+++ b/webrtc/base/autodetectproxy.cc
@@ -32,6 +32,12 @@
: agent_(user_agent), resolver_(NULL), socket_(NULL), next_(0) {
}
+bool AutoDetectProxy::GetProxyForUrl(const char* agent,
+ const char* url,
+ rtc::ProxyInfo* proxy) {
+ return GetProxySettingsForUrl(agent, url, proxy, true);
+}
+
AutoDetectProxy::~AutoDetectProxy() {
if (resolver_) {
resolver_->Destroy(false);
diff --git a/webrtc/base/autodetectproxy.h b/webrtc/base/autodetectproxy.h
index 45e9c40..b9887bc 100644
--- a/webrtc/base/autodetectproxy.h
+++ b/webrtc/base/autodetectproxy.h
@@ -50,20 +50,19 @@
}
// Default implementation of GetProxySettingsForUrl. Override for special
// implementation.
- virtual bool GetProxyForUrl(const char* agent, const char* url,
- rtc::ProxyInfo* proxy) {
- return GetProxySettingsForUrl(agent, url, proxy, true);
- }
+ virtual bool GetProxyForUrl(const char* agent,
+ const char* url,
+ rtc::ProxyInfo* proxy);
enum { MSG_TIMEOUT = SignalThread::ST_MSG_FIRST_AVAILABLE,
MSG_UNRESOLVABLE,
ADP_MSG_FIRST_AVAILABLE};
protected:
- virtual ~AutoDetectProxy();
+ ~AutoDetectProxy() override;
// SignalThread Interface
- virtual void DoWork();
- virtual void OnMessage(Message *msg);
+ void DoWork() override;
+ void OnMessage(Message* msg) override;
void Next();
void Complete(ProxyType type);
diff --git a/webrtc/base/bandwidthsmoother.cc b/webrtc/base/bandwidthsmoother.cc
index b5066af..09c7b99 100644
--- a/webrtc/base/bandwidthsmoother.cc
+++ b/webrtc/base/bandwidthsmoother.cc
@@ -29,6 +29,8 @@
std::min(1.0, std::max(0.0, min_sample_count_percent))) {
}
+BandwidthSmoother::~BandwidthSmoother() = default;
+
// Samples a new bandwidth measurement
// returns true if the bandwidth estimation changed
bool BandwidthSmoother::Sample(uint32 sample_time, int bandwidth) {
diff --git a/webrtc/base/bandwidthsmoother.h b/webrtc/base/bandwidthsmoother.h
index cf5a25d..dbb4c81 100644
--- a/webrtc/base/bandwidthsmoother.h
+++ b/webrtc/base/bandwidthsmoother.h
@@ -35,6 +35,7 @@
double percent_increase,
size_t samples_count_to_average,
double min_sample_count_percent);
+ ~BandwidthSmoother();
// Samples a new bandwidth measurement.
// bandwidth is expected to be non-negative.
diff --git a/webrtc/base/base.gyp b/webrtc/base/base.gyp
index 42d25bf..57ef4f4 100644
--- a/webrtc/base/base.gyp
+++ b/webrtc/base/base.gyp
@@ -37,6 +37,7 @@
'exp_filter.h',
'md5.cc',
'md5.h',
+ 'md5digest.cc',
'md5digest.h',
'platform_file.cc',
'platform_file.h',
@@ -75,7 +76,9 @@
'asyncinvoker.cc',
'asyncinvoker.h',
'asyncinvoker-inl.h',
+ 'asyncpacketsocket.cc',
'asyncpacketsocket.h',
+ 'asyncresolverinterface.cc',
'asyncresolverinterface.h',
'asyncsocket.cc',
'asyncsocket.h',
@@ -94,6 +97,7 @@
'basictypes.h',
'bind.h',
'bind.h.pump',
+ 'buffer.cc',
'buffer.h',
'bytebuffer.cc',
'bytebuffer.h',
@@ -108,6 +112,7 @@
'crc32.cc',
'crc32.h',
'criticalsection.h',
+ 'cryptstring.cc',
'cryptstring.h',
'dbus.cc',
'dbus.h',
@@ -226,11 +231,13 @@
'sec_buffer.h',
'sha1.cc',
'sha1.h',
+ 'sha1digest.cc',
'sha1digest.h',
'sharedexclusivelock.cc',
'sharedexclusivelock.h',
'signalthread.cc',
'signalthread.h',
+ 'sigslot.cc',
'sigslot.h',
'sigslotrepeater.h',
'socket.h',
@@ -350,6 +357,7 @@
'asyncinvoker.cc',
'asyncinvoker.h',
'asyncinvoker-inl.h',
+ 'asyncresolverinterface.cc',
'asyncresolverinterface.h',
'atomicops.h',
'bandwidthsmoother.cc',
@@ -357,6 +365,7 @@
'basictypes.h',
'bind.h',
'bind.h.pump',
+ 'buffer.cc',
'buffer.h',
'callback.h',
'callback.h.pump',
diff --git a/webrtc/base/buffer.cc b/webrtc/base/buffer.cc
new file mode 100644
index 0000000..04d888b
--- /dev/null
+++ b/webrtc/base/buffer.cc
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/buffer.h"
+
+namespace rtc {
+
+Buffer::Buffer() {
+ Construct(NULL, 0, 0);
+}
+
+Buffer::Buffer(const void* data, size_t length) {
+ Construct(data, length, length);
+}
+
+Buffer::Buffer(const void* data, size_t length, size_t capacity) {
+ Construct(data, length, capacity);
+}
+
+Buffer::Buffer(const Buffer& buf) {
+ Construct(buf.data(), buf.length(), buf.length());
+}
+
+Buffer::~Buffer() = default;
+
+}; // namespace rtc
diff --git a/webrtc/base/buffer.h b/webrtc/base/buffer.h
index ddab0fb..a7bc570 100644
--- a/webrtc/base/buffer.h
+++ b/webrtc/base/buffer.h
@@ -22,18 +22,11 @@
// Unlike std::string/vector, does not initialize data when expanding capacity.
class Buffer {
public:
- Buffer() {
- Construct(NULL, 0, 0);
- }
- Buffer(const void* data, size_t length) {
- Construct(data, length, length);
- }
- Buffer(const void* data, size_t length, size_t capacity) {
- Construct(data, length, capacity);
- }
- Buffer(const Buffer& buf) {
- Construct(buf.data(), buf.length(), buf.length());
- }
+ Buffer();
+ Buffer(const void* data, size_t length);
+ Buffer(const void* data, size_t length, size_t capacity);
+ Buffer(const Buffer& buf);
+ ~Buffer();
const char* data() const { return data_.get(); }
char* data() { return data_.get(); }
diff --git a/webrtc/base/cpumonitor.h b/webrtc/base/cpumonitor.h
index 39b09b3..e82ae69 100644
--- a/webrtc/base/cpumonitor.h
+++ b/webrtc/base/cpumonitor.h
@@ -95,7 +95,7 @@
: public rtc::MessageHandler, public sigslot::has_slots<> {
public:
explicit CpuMonitor(Thread* thread);
- virtual ~CpuMonitor();
+ ~CpuMonitor() override;
void set_thread(Thread* thread);
bool Start(int period_ms);
@@ -105,7 +105,7 @@
protected:
// Override virtual method of parent MessageHandler.
- virtual void OnMessage(rtc::Message* msg);
+ void OnMessage(rtc::Message* msg) override;
// Clear the monitor thread and stop sending it messages if the thread goes
// away before our lifetime.
void OnMessageQueueDestroyed() { monitor_thread_ = NULL; }
diff --git a/webrtc/base/cryptstring.cc b/webrtc/base/cryptstring.cc
new file mode 100644
index 0000000..4b2a83f
--- /dev/null
+++ b/webrtc/base/cryptstring.cc
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/cryptstring.h"
+
+namespace rtc {
+
+size_t EmptyCryptStringImpl::GetLength() const {
+ return 0;
+}
+
+void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const {
+ if (nullterminate) {
+ *dest = '\0';
+ }
+}
+
+std::string EmptyCryptStringImpl::UrlEncode() const {
+ return "";
+}
+
+CryptStringImpl* EmptyCryptStringImpl::Copy() const {
+ return new EmptyCryptStringImpl();
+}
+
+void EmptyCryptStringImpl::CopyRawTo(std::vector<unsigned char>* dest) const {
+ dest->clear();
+}
+
+CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {
+}
+
+CryptString::CryptString(const CryptString& other)
+ : impl_(other.impl_->Copy()) {
+}
+
+CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {
+}
+
+CryptString::~CryptString() = default;
+
+size_t InsecureCryptStringImpl::GetLength() const {
+ return password_.size();
+}
+
+void InsecureCryptStringImpl::CopyTo(char* dest, bool nullterminate) const {
+ memcpy(dest, password_.data(), password_.size());
+ if (nullterminate)
+ dest[password_.size()] = 0;
+}
+
+std::string InsecureCryptStringImpl::UrlEncode() const {
+ return password_;
+}
+
+CryptStringImpl* InsecureCryptStringImpl::Copy() const {
+ InsecureCryptStringImpl* copy = new InsecureCryptStringImpl;
+ copy->password() = password_;
+ return copy;
+}
+
+void InsecureCryptStringImpl::CopyRawTo(
+ std::vector<unsigned char>* dest) const {
+ dest->resize(password_.size());
+ memcpy(&dest->front(), password_.data(), password_.size());
+}
+
+}; // namespace rtc
diff --git a/webrtc/base/cryptstring.h b/webrtc/base/cryptstring.h
index f43057d..a6bae51 100644
--- a/webrtc/base/cryptstring.h
+++ b/webrtc/base/cryptstring.h
@@ -33,27 +33,22 @@
class EmptyCryptStringImpl : public CryptStringImpl {
public:
- virtual ~EmptyCryptStringImpl() {}
- virtual size_t GetLength() const { return 0; }
- virtual void CopyTo(char * dest, bool nullterminate) const {
- if (nullterminate) {
- *dest = '\0';
- }
- }
- virtual std::string UrlEncode() const { return ""; }
- virtual CryptStringImpl * Copy() const { return new EmptyCryptStringImpl(); }
- virtual void CopyRawTo(std::vector<unsigned char> * dest) const {
- dest->clear();
- }
+ ~EmptyCryptStringImpl() override {}
+ size_t GetLength() const override;
+ void CopyTo(char* dest, bool nullterminate) const override;
+ std::string UrlEncode() const override;
+ CryptStringImpl* Copy() const override;
+ void CopyRawTo(std::vector<unsigned char>* dest) const override;
};
class CryptString {
public:
- CryptString() : impl_(new EmptyCryptStringImpl()) {}
+ CryptString();
size_t GetLength() const { return impl_->GetLength(); }
void CopyTo(char * dest, bool nullterminate) const { impl_->CopyTo(dest, nullterminate); }
- CryptString(const CryptString & other) : impl_(other.impl_->Copy()) {}
- explicit CryptString(const CryptStringImpl & impl) : impl_(impl.Copy()) {}
+ CryptString(const CryptString& other);
+ explicit CryptString(const CryptStringImpl& impl);
+ ~CryptString();
CryptString & operator=(const CryptString & other) {
if (this != &other) {
impl_.reset(other.impl_->Copy());
@@ -158,22 +153,13 @@
std::string& password() { return password_; }
const std::string& password() const { return password_; }
- virtual ~InsecureCryptStringImpl() {}
- virtual size_t GetLength() const { return password_.size(); }
- virtual void CopyTo(char * dest, bool nullterminate) const {
- memcpy(dest, password_.data(), password_.size());
- if (nullterminate) dest[password_.size()] = 0;
- }
- virtual std::string UrlEncode() const { return password_; }
- virtual CryptStringImpl * Copy() const {
- InsecureCryptStringImpl * copy = new InsecureCryptStringImpl;
- copy->password() = password_;
- return copy;
- }
- virtual void CopyRawTo(std::vector<unsigned char> * dest) const {
- dest->resize(password_.size());
- memcpy(&dest->front(), password_.data(), password_.size());
- }
+ ~InsecureCryptStringImpl() override = default;
+ size_t GetLength() const override;
+ void CopyTo(char* dest, bool nullterminate) const override;
+ std::string UrlEncode() const override;
+ CryptStringImpl* Copy() const override;
+ void CopyRawTo(std::vector<unsigned char>* dest) const override;
+
private:
std::string password_;
};
diff --git a/webrtc/base/diskcache.cc b/webrtc/base/diskcache.cc
index d0e5405..6bbc53e 100644
--- a/webrtc/base/diskcache.cc
+++ b/webrtc/base/diskcache.cc
@@ -43,7 +43,7 @@
StreamInterface* stream)
: StreamAdapterInterface(stream), cache_(cache), id_(id), index_(index)
{ }
- virtual ~DiskCacheAdapter() {
+ ~DiskCacheAdapter() override {
Close();
cache_->ReleaseResource(id_, index_);
}
diff --git a/webrtc/base/fileutils.cc b/webrtc/base/fileutils.cc
index 24375c9..6f385d7 100644
--- a/webrtc/base/fileutils.cc
+++ b/webrtc/base/fileutils.cc
@@ -148,6 +148,10 @@
return default_filesystem_;
}
+DirectoryIterator* FilesystemInterface::IterateDirectory() {
+ return new DirectoryIterator();
+}
+
bool FilesystemInterface::CopyFolder(const Pathname &old_path,
const Pathname &new_path) {
bool success = true;
@@ -208,6 +212,10 @@
return success;
}
+bool FilesystemInterface::DeleteFolderAndContents(const Pathname& folder) {
+ return DeleteFolderContents(folder) && DeleteEmptyFolder(folder);
+}
+
bool FilesystemInterface::CleanAppTempFolder() {
Pathname path;
if (!GetAppTempFolder(&path))
diff --git a/webrtc/base/fileutils.h b/webrtc/base/fileutils.h
index 9112952..1533fb5 100644
--- a/webrtc/base/fileutils.h
+++ b/webrtc/base/fileutils.h
@@ -95,9 +95,7 @@
// Returns a DirectoryIterator for a given pathname.
// TODO: Do fancy abstracted stuff
- virtual DirectoryIterator *IterateDirectory() {
- return new DirectoryIterator();
- }
+ virtual DirectoryIterator* IterateDirectory();
// Opens a file. Returns an open StreamInterface if function succeeds.
// Otherwise, returns NULL.
@@ -133,9 +131,7 @@
// This deletes the contents of a folder, recursively, and then deletes
// the folder itself.
- virtual bool DeleteFolderAndContents(const Pathname &folder) {
- return DeleteFolderContents(folder) && DeleteEmptyFolder(folder);
- }
+ virtual bool DeleteFolderAndContents(const Pathname& folder);
// This will delete whatever is located at path, be it a file or a folder.
// If it is a folder, it will delete it recursively by calling
diff --git a/webrtc/base/firewallsocketserver.cc b/webrtc/base/firewallsocketserver.cc
index 31c18d9..c35a687 100644
--- a/webrtc/base/firewallsocketserver.cc
+++ b/webrtc/base/firewallsocketserver.cc
@@ -25,7 +25,7 @@
: AsyncSocketAdapter(socket), server_(server), type_(type) {
}
- virtual int Connect(const SocketAddress& addr) {
+ int Connect(const SocketAddress& addr) override {
if (type_ == SOCK_STREAM) {
if (!server_->Check(FP_TCP, GetLocalAddress(), addr)) {
LOG(LS_VERBOSE) << "FirewallSocket outbound TCP connection from "
@@ -38,10 +38,10 @@
}
return AsyncSocketAdapter::Connect(addr);
}
- virtual int Send(const void* pv, size_t cb) {
+ int Send(const void* pv, size_t cb) override {
return SendTo(pv, cb, GetRemoteAddress());
}
- virtual int SendTo(const void* pv, size_t cb, const SocketAddress& addr) {
+ int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override {
if (type_ == SOCK_DGRAM) {
if (!server_->Check(FP_UDP, GetLocalAddress(), addr)) {
LOG(LS_VERBOSE) << "FirewallSocket outbound UDP packet from "
@@ -52,11 +52,11 @@
}
return AsyncSocketAdapter::SendTo(pv, cb, addr);
}
- virtual int Recv(void* pv, size_t cb) {
+ int Recv(void* pv, size_t cb) override {
SocketAddress addr;
return RecvFrom(pv, cb, &addr);
}
- virtual int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) {
+ int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override {
if (type_ == SOCK_DGRAM) {
while (true) {
int res = AsyncSocketAdapter::RecvFrom(pv, cb, paddr);
@@ -72,7 +72,7 @@
return AsyncSocketAdapter::RecvFrom(pv, cb, paddr);
}
- virtual int Listen(int backlog) {
+ int Listen(int backlog) override {
if (!server_->tcp_listen_enabled()) {
LOG(LS_VERBOSE) << "FirewallSocket listen attempt denied";
return -1;
@@ -80,7 +80,7 @@
return AsyncSocketAdapter::Listen(backlog);
}
- virtual AsyncSocket* Accept(SocketAddress* paddr) {
+ AsyncSocket* Accept(SocketAddress* paddr) override {
SocketAddress addr;
while (AsyncSocket* sock = AsyncSocketAdapter::Accept(&addr)) {
if (server_->Check(FP_TCP, addr, GetLocalAddress())) {
@@ -190,6 +190,18 @@
return WrapSocket(server_->CreateAsyncSocket(family, type), type);
}
+void FirewallSocketServer::SetMessageQueue(MessageQueue* queue) {
+ server_->SetMessageQueue(queue);
+}
+
+bool FirewallSocketServer::Wait(int cms, bool process_io) {
+ return server_->Wait(cms, process_io);
+}
+
+void FirewallSocketServer::WakeUp() {
+ return server_->WakeUp();
+}
+
AsyncSocket* FirewallSocketServer::WrapSocket(AsyncSocket* sock, int type) {
if (!sock ||
(type == SOCK_STREAM && !tcp_sockets_enabled_) ||
diff --git a/webrtc/base/firewallsocketserver.h b/webrtc/base/firewallsocketserver.h
index 500b739..26fc75e 100644
--- a/webrtc/base/firewallsocketserver.h
+++ b/webrtc/base/firewallsocketserver.h
@@ -29,7 +29,7 @@
FirewallSocketServer(SocketServer * server,
FirewallManager * manager = NULL,
bool should_delete_server = false);
- virtual ~FirewallSocketServer();
+ ~FirewallSocketServer() override;
SocketServer* socketserver() const { return server_; }
void set_socketserver(SocketServer* server) {
@@ -58,21 +58,15 @@
bool Check(FirewallProtocol p,
const SocketAddress& src, const SocketAddress& dst);
- virtual Socket* CreateSocket(int type);
- virtual Socket* CreateSocket(int family, int type);
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
- virtual void SetMessageQueue(MessageQueue* queue) {
- server_->SetMessageQueue(queue);
- }
- virtual bool Wait(int cms, bool process_io) {
- return server_->Wait(cms, process_io);
- }
- virtual void WakeUp() {
- return server_->WakeUp();
- }
+ void SetMessageQueue(MessageQueue* queue) override;
+ bool Wait(int cms, bool process_io) override;
+ void WakeUp() override;
Socket * WrapSocket(Socket * sock, int type);
AsyncSocket * WrapSocket(AsyncSocket * sock, int type);
diff --git a/webrtc/base/helpers.cc b/webrtc/base/helpers.cc
index 84d1c93..bd7ff96 100644
--- a/webrtc/base/helpers.cc
+++ b/webrtc/base/helpers.cc
@@ -51,11 +51,9 @@
class SecureRandomGenerator : public RandomGenerator {
public:
SecureRandomGenerator() {}
- ~SecureRandomGenerator() {}
- virtual bool Init(const void* seed, size_t len) {
- return true;
- }
- virtual bool Generate(void* buf, size_t len) {
+ ~SecureRandomGenerator() override {}
+ bool Init(const void* seed, size_t len) override { return true; }
+ bool Generate(void* buf, size_t len) override {
return (RAND_bytes(reinterpret_cast<unsigned char*>(buf), len) > 0);
}
};
@@ -65,11 +63,9 @@
class SecureRandomGenerator : public RandomGenerator {
public:
SecureRandomGenerator() {}
- ~SecureRandomGenerator() {}
- virtual bool Init(const void* seed, size_t len) {
- return true;
- }
- virtual bool Generate(void* buf, size_t len) {
+ ~SecureRandomGenerator() override {}
+ bool Init(const void* seed, size_t len) override { return true; }
+ bool Generate(void* buf, size_t len) override {
return (PK11_GenerateRandom(reinterpret_cast<unsigned char*>(buf),
static_cast<int>(len)) == SECSuccess);
}
@@ -153,12 +149,10 @@
public:
TestRandomGenerator() : seed_(7) {
}
- ~TestRandomGenerator() {
+ ~TestRandomGenerator() override {
}
- virtual bool Init(const void* seed, size_t len) {
- return true;
- }
- virtual bool Generate(void* buf, size_t len) {
+ bool Init(const void* seed, size_t len) override { return true; }
+ bool Generate(void* buf, size_t len) override {
for (size_t i = 0; i < len; ++i) {
static_cast<uint8*>(buf)[i] = static_cast<uint8>(GetRandom());
}
diff --git a/webrtc/base/httpbase.cc b/webrtc/base/httpbase.cc
index 7649c42..81ca4cc 100644
--- a/webrtc/base/httpbase.cc
+++ b/webrtc/base/httpbase.cc
@@ -234,7 +234,7 @@
BlockingMemoryStream(char* buffer, size_t size)
: ExternalMemoryStream(buffer, size) { }
- virtual StreamResult DoReserve(size_t size, int* error) {
+ StreamResult DoReserve(size_t size, int* error) override {
return (buffer_length_ >= size) ? SR_SUCCESS : SR_BLOCK;
}
};
@@ -243,7 +243,7 @@
public:
DocumentStream(HttpBase* base) : base_(base), error_(HE_DEFAULT) { }
- virtual StreamState GetState() const {
+ StreamState GetState() const override {
if (NULL == base_)
return SS_CLOSED;
if (HM_RECV == base_->mode_)
@@ -251,8 +251,10 @@
return SS_OPENING;
}
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error) {
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override {
if (!base_) {
if (error) *error = error_;
return (HE_NONE == error_) ? SR_EOS : SR_ERROR;
@@ -309,13 +311,15 @@
return result;
}
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error) {
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override {
if (error) *error = -1;
return SR_ERROR;
}
- virtual void Close() {
+ void Close() override {
if (base_) {
HttpBase* base = Disconnect(HE_NONE);
if (HM_RECV == base->mode_ && base->http_stream_) {
@@ -326,7 +330,7 @@
}
}
- virtual bool GetAvailable(size_t* size) const {
+ bool GetAvailable(size_t* size) const override {
if (!base_ || HM_RECV != base_->mode_)
return false;
size_t data_size = base_->GetDataRemaining();
diff --git a/webrtc/base/httpbase.h b/webrtc/base/httpbase.h
index 424a61f..7f368f8 100644
--- a/webrtc/base/httpbase.h
+++ b/webrtc/base/httpbase.h
@@ -94,7 +94,7 @@
{
public:
HttpBase();
- virtual ~HttpBase();
+ ~HttpBase() override;
void notify(IHttpNotify* notify) { notify_ = notify; }
bool attach(StreamInterface* stream);
@@ -145,16 +145,22 @@
void OnDocumentEvent(StreamInterface* stream, int events, int error);
// HttpParser Interface
- virtual ProcessResult ProcessLeader(const char* line, size_t len,
- HttpError* error);
- virtual ProcessResult ProcessHeader(const char* name, size_t nlen,
- const char* value, size_t vlen,
- HttpError* error);
- virtual ProcessResult ProcessHeaderComplete(bool chunked, size_t& data_size,
- HttpError* error);
- virtual ProcessResult ProcessData(const char* data, size_t len, size_t& read,
- HttpError* error);
- virtual void OnComplete(HttpError err);
+ ProcessResult ProcessLeader(const char* line,
+ size_t len,
+ HttpError* error) override;
+ ProcessResult ProcessHeader(const char* name,
+ size_t nlen,
+ const char* value,
+ size_t vlen,
+ HttpError* error) override;
+ ProcessResult ProcessHeaderComplete(bool chunked,
+ size_t& data_size,
+ HttpError* error) override;
+ ProcessResult ProcessData(const char* data,
+ size_t len,
+ size_t& read,
+ HttpError* error) override;
+ void OnComplete(HttpError err) override;
private:
class DocumentStream;
diff --git a/webrtc/base/httpclient.h b/webrtc/base/httpclient.h
index b634b93..2983d8c 100644
--- a/webrtc/base/httpclient.h
+++ b/webrtc/base/httpclient.h
@@ -62,7 +62,7 @@
// be freed by the caller. Otherwise, an internal object is allocated.
HttpClient(const std::string& agent, StreamPool* pool,
HttpTransaction* transaction = NULL);
- virtual ~HttpClient();
+ ~HttpClient() override;
void set_pool(StreamPool* pool) { pool_ = pool; }
@@ -161,10 +161,10 @@
void OnResolveResult(AsyncResolverInterface* resolver);
// IHttpNotify Interface
- virtual HttpError onHttpHeaderComplete(bool chunked, size_t& data_size);
- virtual void onHttpComplete(HttpMode mode, HttpError err);
- virtual void onHttpClosed(HttpError err);
-
+ HttpError onHttpHeaderComplete(bool chunked, size_t& data_size) override;
+ void onHttpComplete(HttpMode mode, HttpError err) override;
+ void onHttpClosed(HttpError err) override;
+
private:
enum CacheState { CS_READY, CS_WRITING, CS_READING, CS_VALIDATING };
bool IsCacheActive() const { return (cache_state_ > CS_READY); }
diff --git a/webrtc/base/httpcommon.cc b/webrtc/base/httpcommon.cc
index 79cf87a..e81c2e8 100644
--- a/webrtc/base/httpcommon.cc
+++ b/webrtc/base/httpcommon.cc
@@ -401,6 +401,11 @@
// HttpData
//////////////////////////////////////////////////////////////////////
+HttpData::HttpData() : version(HVER_1_1) {
+}
+
+HttpData::~HttpData() = default;
+
void
HttpData::clear(bool release_document) {
// Clear headers first, since releasing a document may have far-reaching
diff --git a/webrtc/base/httpcommon.h b/webrtc/base/httpcommon.h
index c43a9e2..7b20fac 100644
--- a/webrtc/base/httpcommon.h
+++ b/webrtc/base/httpcommon.h
@@ -283,7 +283,7 @@
HttpVersion version;
scoped_ptr<StreamInterface> document;
- HttpData() : version(HVER_1_1) { }
+ HttpData();
enum HeaderCombine { HC_YES, HC_NO, HC_AUTO, HC_REPLACE, HC_NEW };
void changeHeader(const std::string& name, const std::string& value,
@@ -368,7 +368,7 @@
virtual HttpError parseLeader(const char* line, size_t len) = 0;
protected:
- virtual ~HttpData() { }
+ virtual ~HttpData();
void clear(bool release_document);
void copy(const HttpData& src);
@@ -385,8 +385,8 @@
void clear(bool release_document);
void copy(const HttpRequestData& src);
- virtual size_t formatLeader(char* buffer, size_t size) const;
- virtual HttpError parseLeader(const char* line, size_t len);
+ size_t formatLeader(char* buffer, size_t size) const override;
+ HttpError parseLeader(const char* line, size_t len) override;
bool getAbsoluteUri(std::string* uri) const;
bool getRelativeUri(std::string* host, std::string* path) const;
@@ -408,8 +408,8 @@
uint32 scode = HC_MOVED_TEMPORARILY);
void set_error(uint32 scode);
- virtual size_t formatLeader(char* buffer, size_t size) const;
- virtual HttpError parseLeader(const char* line, size_t len);
+ size_t formatLeader(char* buffer, size_t size) const override;
+ HttpError parseLeader(const char* line, size_t len) override;
};
struct HttpTransaction {
diff --git a/webrtc/base/httprequest.cc b/webrtc/base/httprequest.cc
index 9ce2377..3199c8f 100644
--- a/webrtc/base/httprequest.cc
+++ b/webrtc/base/httprequest.cc
@@ -54,6 +54,8 @@
client_(user_agent.c_str(), NULL), error_(HE_NONE) {
}
+HttpRequest::~HttpRequest() = default;
+
void HttpRequest::Send() {
// TODO: Rewrite this to use the thread's native socket server, and a more
// natural flow?
diff --git a/webrtc/base/httprequest.h b/webrtc/base/httprequest.h
index 3798332..fa2ffdb 100644
--- a/webrtc/base/httprequest.h
+++ b/webrtc/base/httprequest.h
@@ -30,6 +30,7 @@
class HttpRequest {
public:
HttpRequest(const std::string &user_agent);
+ ~HttpRequest();
void Send();
diff --git a/webrtc/base/httpserver.h b/webrtc/base/httpserver.h
index 77de615..30c8f4c 100644
--- a/webrtc/base/httpserver.h
+++ b/webrtc/base/httpserver.h
@@ -80,7 +80,7 @@
class Connection : private IHttpNotify {
public:
Connection(int connection_id, HttpServer* server);
- virtual ~Connection();
+ ~Connection() override;
void BeginProcess(StreamInterface* stream);
StreamInterface* EndProcess();
@@ -89,10 +89,10 @@
void InitiateClose(bool force);
// IHttpNotify Interface
- virtual HttpError onHttpHeaderComplete(bool chunked, size_t& data_size);
- virtual void onHttpComplete(HttpMode mode, HttpError err);
- virtual void onHttpClosed(HttpError err);
-
+ HttpError onHttpHeaderComplete(bool chunked, size_t& data_size) override;
+ void onHttpComplete(HttpMode mode, HttpError err) override;
+ void onHttpClosed(HttpError err) override;
+
int connection_id_;
HttpServer* server_;
HttpBase base_;
@@ -116,7 +116,7 @@
class HttpListenServer : public HttpServer, public sigslot::has_slots<> {
public:
HttpListenServer();
- virtual ~HttpListenServer();
+ ~HttpListenServer() override;
int Listen(const SocketAddress& address);
bool GetAddress(SocketAddress* address) const;
diff --git a/webrtc/base/macasyncsocket.h b/webrtc/base/macasyncsocket.h
index bf83865..1aa4fe1 100644
--- a/webrtc/base/macasyncsocket.h
+++ b/webrtc/base/macasyncsocket.h
@@ -28,29 +28,30 @@
class MacAsyncSocket : public AsyncSocket, public sigslot::has_slots<> {
public:
MacAsyncSocket(MacBaseSocketServer* ss, int family);
- virtual ~MacAsyncSocket();
+ ~MacAsyncSocket() override;
bool valid() const { return source_ != NULL; }
// Socket interface
- virtual SocketAddress GetLocalAddress() const;
- virtual SocketAddress GetRemoteAddress() const;
- virtual int Bind(const SocketAddress& addr);
- virtual int Connect(const SocketAddress& addr);
- virtual int Send(const void* buffer, size_t length);
- virtual int SendTo(const void* buffer, size_t length,
- const SocketAddress& addr);
- virtual int Recv(void* buffer, size_t length);
- virtual int RecvFrom(void* buffer, size_t length, SocketAddress* out_addr);
- virtual int Listen(int backlog);
- virtual MacAsyncSocket* Accept(SocketAddress* out_addr);
- virtual int Close();
- virtual int GetError() const;
- virtual void SetError(int error);
- virtual ConnState GetState() const;
- virtual int EstimateMTU(uint16* mtu);
- virtual int GetOption(Option opt, int* value);
- virtual int SetOption(Option opt, int value);
+ SocketAddress GetLocalAddress() const override;
+ SocketAddress GetRemoteAddress() const override;
+ int Bind(const SocketAddress& addr) override;
+ int Connect(const SocketAddress& addr) override;
+ int Send(const void* buffer, size_t length) override;
+ int SendTo(const void* buffer,
+ size_t length,
+ const SocketAddress& addr) override;
+ int Recv(void* buffer, size_t length) override;
+ int RecvFrom(void* buffer, size_t length, SocketAddress* out_addr) override;
+ int Listen(int backlog) override;
+ MacAsyncSocket* Accept(SocketAddress* out_addr) override;
+ int Close() override;
+ int GetError() const override;
+ void SetError(int error) override;
+ ConnState GetState() const override;
+ int EstimateMTU(uint16* mtu) override;
+ int GetOption(Option opt, int* value) override;
+ int SetOption(Option opt, int value) override;
// For the MacBaseSocketServer to disable callbacks when process_io is false.
void EnableCallbacks();
diff --git a/webrtc/base/maccocoasocketserver.h b/webrtc/base/maccocoasocketserver.h
index d5deac1..0e171b4 100644
--- a/webrtc/base/maccocoasocketserver.h
+++ b/webrtc/base/maccocoasocketserver.h
@@ -29,10 +29,10 @@
class MacCocoaSocketServer : public MacBaseSocketServer {
public:
explicit MacCocoaSocketServer();
- virtual ~MacCocoaSocketServer();
+ ~MacCocoaSocketServer() override;
- virtual bool Wait(int cms, bool process_io);
- virtual void WakeUp();
+ bool Wait(int cms, bool process_io) override;
+ void WakeUp() override;
private:
MacCocoaSocketServerHelperRtc* helper_;
diff --git a/webrtc/base/macsocketserver.cc b/webrtc/base/macsocketserver.cc
index c7ab6e4..96b2091 100644
--- a/webrtc/base/macsocketserver.cc
+++ b/webrtc/base/macsocketserver.cc
@@ -29,6 +29,14 @@
MacBaseSocketServer::~MacBaseSocketServer() {
}
+Socket* MacBaseSocketServer::CreateSocket(int type) {
+ return NULL;
+}
+
+Socket* MacBaseSocketServer::CreateSocket(int family, int type) {
+ return NULL;
+}
+
AsyncSocket* MacBaseSocketServer::CreateAsyncSocket(int type) {
return CreateAsyncSocket(AF_INET, type);
}
diff --git a/webrtc/base/macsocketserver.h b/webrtc/base/macsocketserver.h
index 8eebac6..f85628b 100644
--- a/webrtc/base/macsocketserver.h
+++ b/webrtc/base/macsocketserver.h
@@ -26,23 +26,23 @@
class MacBaseSocketServer : public PhysicalSocketServer {
public:
MacBaseSocketServer();
- virtual ~MacBaseSocketServer();
+ ~MacBaseSocketServer() override;
// SocketServer Interface
- virtual Socket* CreateSocket(int type) { return NULL; }
- virtual Socket* CreateSocket(int family, int type) { return NULL; }
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
- virtual bool Wait(int cms, bool process_io) = 0;
- virtual void WakeUp() = 0;
+ bool Wait(int cms, bool process_io) override = 0;
+ void WakeUp() override = 0;
void RegisterSocket(MacAsyncSocket* socket);
void UnregisterSocket(MacAsyncSocket* socket);
// PhysicalSocketServer Overrides
- virtual bool SetPosixSignalHandler(int signum, void (*handler)(int));
+ bool SetPosixSignalHandler(int signum, void (*handler)(int)) override;
protected:
void EnableSocketCallbacks(bool enable);
@@ -65,11 +65,11 @@
class MacCFSocketServer : public MacBaseSocketServer {
public:
MacCFSocketServer();
- virtual ~MacCFSocketServer();
+ ~MacCFSocketServer() override;
// SocketServer Interface
- virtual bool Wait(int cms, bool process_io);
- virtual void WakeUp();
+ bool Wait(int cms, bool process_io) override;
+ void WakeUp() override;
void OnWakeUpCallback();
private:
diff --git a/webrtc/base/macwindowpicker.h b/webrtc/base/macwindowpicker.h
index 9a44747..99091a9 100644
--- a/webrtc/base/macwindowpicker.h
+++ b/webrtc/base/macwindowpicker.h
@@ -17,14 +17,15 @@
class MacWindowPicker : public WindowPicker {
public:
MacWindowPicker();
- ~MacWindowPicker();
- virtual bool Init();
- virtual bool IsVisible(const WindowId& id);
- virtual bool MoveToFront(const WindowId& id);
- virtual bool GetWindowList(WindowDescriptionList* descriptions);
- virtual bool GetDesktopList(DesktopDescriptionList* descriptions);
- virtual bool GetDesktopDimensions(const DesktopId& id, int* width,
- int* height);
+ ~MacWindowPicker() override;
+ bool Init() override;
+ bool IsVisible(const WindowId& id) override;
+ bool MoveToFront(const WindowId& id) override;
+ bool GetWindowList(WindowDescriptionList* descriptions) override;
+ bool GetDesktopList(DesktopDescriptionList* descriptions) override;
+ bool GetDesktopDimensions(const DesktopId& id,
+ int* width,
+ int* height) override;
private:
void* lib_handle_;
diff --git a/webrtc/base/md5digest.cc b/webrtc/base/md5digest.cc
new file mode 100644
index 0000000..1d014c3
--- /dev/null
+++ b/webrtc/base/md5digest.cc
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/md5digest.h"
+
+namespace rtc {
+
+size_t Md5Digest::Size() const {
+ return kSize;
+}
+
+void Md5Digest::Update(const void* buf, size_t len) {
+ MD5Update(&ctx_, static_cast<const uint8*>(buf), len);
+}
+
+size_t Md5Digest::Finish(void* buf, size_t len) {
+ if (len < kSize) {
+ return 0;
+ }
+ MD5Final(&ctx_, static_cast<uint8*>(buf));
+ MD5Init(&ctx_); // Reset for next use.
+ return kSize;
+}
+
+}; // namespace rtc
diff --git a/webrtc/base/md5digest.h b/webrtc/base/md5digest.h
index 5e85802..df346e5 100644
--- a/webrtc/base/md5digest.h
+++ b/webrtc/base/md5digest.h
@@ -23,20 +23,10 @@
Md5Digest() {
MD5Init(&ctx_);
}
- virtual size_t Size() const {
- return kSize;
- }
- virtual void Update(const void* buf, size_t len) {
- MD5Update(&ctx_, static_cast<const uint8*>(buf), len);
- }
- virtual size_t Finish(void* buf, size_t len) {
- if (len < kSize) {
- return 0;
- }
- MD5Final(&ctx_, static_cast<uint8*>(buf));
- MD5Init(&ctx_); // Reset for next use.
- return kSize;
- }
+ size_t Size() const override;
+ void Update(const void* buf, size_t len) override;
+ size_t Finish(void* buf, size_t len) override;
+
private:
MD5_CTX ctx_;
};
diff --git a/webrtc/base/messagequeue.cc b/webrtc/base/messagequeue.cc
index 3706898..53e451f 100644
--- a/webrtc/base/messagequeue.cc
+++ b/webrtc/base/messagequeue.cc
@@ -297,6 +297,20 @@
ss_->WakeUp();
}
+void MessageQueue::PostDelayed(int cmsDelay,
+ MessageHandler* phandler,
+ uint32 id,
+ MessageData* pdata) {
+ return DoDelayPost(cmsDelay, TimeAfter(cmsDelay), phandler, id, pdata);
+}
+
+void MessageQueue::PostAt(uint32 tstamp,
+ MessageHandler* phandler,
+ uint32 id,
+ MessageData* pdata) {
+ return DoDelayPost(TimeUntil(tstamp), tstamp, phandler, id, pdata);
+}
+
void MessageQueue::DoDelayPost(int cmsDelay, uint32 tstamp,
MessageHandler *phandler, uint32 id, MessageData* pdata) {
if (fStop_)
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h
index 5fd5838..e0cab8f 100644
--- a/webrtc/base/messagequeue.h
+++ b/webrtc/base/messagequeue.h
@@ -192,14 +192,14 @@
virtual bool Peek(Message *pmsg, int cmsWait = 0);
virtual void Post(MessageHandler *phandler, uint32 id = 0,
MessageData *pdata = NULL, bool time_sensitive = false);
- virtual void PostDelayed(int cmsDelay, MessageHandler *phandler,
- uint32 id = 0, MessageData *pdata = NULL) {
- return DoDelayPost(cmsDelay, TimeAfter(cmsDelay), phandler, id, pdata);
- }
- virtual void PostAt(uint32 tstamp, MessageHandler *phandler,
- uint32 id = 0, MessageData *pdata = NULL) {
- return DoDelayPost(TimeUntil(tstamp), tstamp, phandler, id, pdata);
- }
+ virtual void PostDelayed(int cmsDelay,
+ MessageHandler* phandler,
+ uint32 id = 0,
+ MessageData* pdata = NULL);
+ virtual void PostAt(uint32 tstamp,
+ MessageHandler* phandler,
+ uint32 id = 0,
+ MessageData* pdata = NULL);
virtual void Clear(MessageHandler *phandler, uint32 id = MQID_ANY,
MessageList* removed = NULL);
virtual void Dispatch(Message *pmsg);
diff --git a/webrtc/base/multipart.h b/webrtc/base/multipart.h
index a41f596..1eeef5c 100644
--- a/webrtc/base/multipart.h
+++ b/webrtc/base/multipart.h
@@ -27,7 +27,7 @@
class MultipartStream : public StreamInterface, public sigslot::has_slots<> {
public:
MultipartStream(const std::string& type, const std::string& boundary);
- virtual ~MultipartStream();
+ ~MultipartStream() override;
void GetContentType(std::string* content_type);
@@ -48,16 +48,20 @@
size_t GetEndPartSize() const;
// StreamInterface
- virtual StreamState GetState() const;
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
- virtual bool SetPosition(size_t position);
- virtual bool GetPosition(size_t* position) const;
- virtual bool GetSize(size_t* size) const;
- virtual bool GetAvailable(size_t* size) const;
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
+ bool SetPosition(size_t position) override;
+ bool GetPosition(size_t* position) const override;
+ bool GetSize(size_t* size) const override;
+ bool GetAvailable(size_t* size) const override;
private:
typedef std::vector<StreamInterface*> PartList;
diff --git a/webrtc/base/natserver.h b/webrtc/base/natserver.h
index 1db77da..16c6d93 100644
--- a/webrtc/base/natserver.h
+++ b/webrtc/base/natserver.h
@@ -54,7 +54,7 @@
NATServer(
NATType type, SocketFactory* internal, const SocketAddress& internal_addr,
SocketFactory* external, const SocketAddress& external_ip);
- ~NATServer();
+ ~NATServer() override;
SocketAddress internal_address() const {
return server_socket_->GetLocalAddress();
diff --git a/webrtc/base/natsocketfactory.cc b/webrtc/base/natsocketfactory.cc
index b5ae67b..9c6756b 100644
--- a/webrtc/base/natsocketfactory.cc
+++ b/webrtc/base/natsocketfactory.cc
@@ -72,20 +72,20 @@
socket_(NULL), buf_(NULL), size_(0) {
}
- virtual ~NATSocket() {
+ ~NATSocket() override {
delete socket_;
delete[] buf_;
}
- virtual SocketAddress GetLocalAddress() const {
+ SocketAddress GetLocalAddress() const override {
return (socket_) ? socket_->GetLocalAddress() : SocketAddress();
}
- virtual SocketAddress GetRemoteAddress() const {
+ SocketAddress GetRemoteAddress() const override {
return remote_addr_; // will be NIL if not connected
}
- virtual int Bind(const SocketAddress& addr) {
+ int Bind(const SocketAddress& addr) override {
if (socket_) { // already bound, bubble up error
return -1;
}
@@ -107,7 +107,7 @@
return result;
}
- virtual int Connect(const SocketAddress& addr) {
+ int Connect(const SocketAddress& addr) override {
if (!socket_) { // socket must be bound, for now
return -1;
}
@@ -126,12 +126,14 @@
return result;
}
- virtual int Send(const void* data, size_t size) {
+ int Send(const void* data, size_t size) override {
ASSERT(connected_);
return SendTo(data, size, remote_addr_);
}
- virtual int SendTo(const void* data, size_t size, const SocketAddress& addr) {
+ int SendTo(const void* data,
+ size_t size,
+ const SocketAddress& addr) override {
ASSERT(!connected_ || addr == remote_addr_);
if (server_addr_.IsNil() || type_ == SOCK_STREAM) {
return socket_->SendTo(data, size, addr);
@@ -151,12 +153,12 @@
return result;
}
- virtual int Recv(void* data, size_t size) {
+ int Recv(void* data, size_t size) override {
SocketAddress addr;
return RecvFrom(data, size, &addr);
}
- virtual int RecvFrom(void* data, size_t size, SocketAddress *out_addr) {
+ int RecvFrom(void* data, size_t size, SocketAddress* out_addr) override {
if (server_addr_.IsNil() || type_ == SOCK_STREAM) {
return socket_->RecvFrom(data, size, out_addr);
}
@@ -196,7 +198,7 @@
return result;
}
- virtual int Close() {
+ int Close() override {
int result = 0;
if (socket_) {
result = socket_->Close();
@@ -210,28 +212,20 @@
return result;
}
- virtual int Listen(int backlog) {
- return socket_->Listen(backlog);
- }
- virtual AsyncSocket* Accept(SocketAddress *paddr) {
+ int Listen(int backlog) override { return socket_->Listen(backlog); }
+ AsyncSocket* Accept(SocketAddress* paddr) override {
return socket_->Accept(paddr);
}
- virtual int GetError() const {
- return socket_->GetError();
- }
- virtual void SetError(int error) {
- socket_->SetError(error);
- }
- virtual ConnState GetState() const {
+ int GetError() const override { return socket_->GetError(); }
+ void SetError(int error) override { socket_->SetError(error); }
+ ConnState GetState() const override {
return connected_ ? CS_CONNECTED : CS_CLOSED;
}
- virtual int EstimateMTU(uint16* mtu) {
- return socket_->EstimateMTU(mtu);
- }
- virtual int GetOption(Option opt, int* value) {
+ int EstimateMTU(uint16* mtu) override { return socket_->EstimateMTU(mtu); }
+ int GetOption(Option opt, int* value) override {
return socket_->GetOption(opt, value);
}
- virtual int SetOption(Option opt, int value) {
+ int SetOption(Option opt, int value) override {
return socket_->SetOption(opt, value);
}
@@ -371,6 +365,19 @@
return new NATSocket(this, family, type);
}
+void NATSocketServer::SetMessageQueue(MessageQueue* queue) {
+ msg_queue_ = queue;
+ server_->SetMessageQueue(queue);
+}
+
+bool NATSocketServer::Wait(int cms, bool process_io) {
+ return server_->Wait(cms, process_io);
+}
+
+void NATSocketServer::WakeUp() {
+ server_->WakeUp();
+}
+
AsyncSocket* NATSocketServer::CreateInternalSocket(int family, int type,
const SocketAddress& local_addr, SocketAddress* nat_addr) {
AsyncSocket* socket = NULL;
@@ -400,6 +407,7 @@
ext_factory, ext_ip));
}
+NATSocketServer::Translator::~Translator() = default;
NATSocketServer::Translator* NATSocketServer::Translator::GetTranslator(
const SocketAddress& ext_ip) {
diff --git a/webrtc/base/natsocketfactory.h b/webrtc/base/natsocketfactory.h
index 6a8e20f..cafd78c 100644
--- a/webrtc/base/natsocketfactory.h
+++ b/webrtc/base/natsocketfactory.h
@@ -40,14 +40,16 @@
NATSocketFactory(SocketFactory* factory, const SocketAddress& nat_addr);
// SocketFactory implementation
- virtual Socket* CreateSocket(int type);
- virtual Socket* CreateSocket(int family, int type);
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
// NATInternalSocketFactory implementation
- virtual AsyncSocket* CreateInternalSocket(int family, int type,
- const SocketAddress& local_addr, SocketAddress* nat_addr);
+ AsyncSocket* CreateInternalSocket(int family,
+ int type,
+ const SocketAddress& local_addr,
+ SocketAddress* nat_addr) override;
private:
SocketFactory* factory_;
@@ -89,6 +91,7 @@
Translator(NATSocketServer* server, NATType type,
const SocketAddress& int_addr, SocketFactory* ext_factory,
const SocketAddress& ext_addr);
+ ~Translator();
SocketFactory* internal_factory() { return internal_factory_.get(); }
SocketAddress internal_address() const {
@@ -128,26 +131,21 @@
void RemoveTranslator(const SocketAddress& ext_ip);
// SocketServer implementation
- virtual Socket* CreateSocket(int type);
- virtual Socket* CreateSocket(int family, int type);
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
- virtual void SetMessageQueue(MessageQueue* queue) {
- msg_queue_ = queue;
- server_->SetMessageQueue(queue);
- }
- virtual bool Wait(int cms, bool process_io) {
- return server_->Wait(cms, process_io);
- }
- virtual void WakeUp() {
- server_->WakeUp();
- }
+ void SetMessageQueue(MessageQueue* queue) override;
+ bool Wait(int cms, bool process_io) override;
+ void WakeUp() override;
// NATInternalSocketFactory implementation
- virtual AsyncSocket* CreateInternalSocket(int family, int type,
- const SocketAddress& local_addr, SocketAddress* nat_addr);
+ AsyncSocket* CreateInternalSocket(int family,
+ int type,
+ const SocketAddress& local_addr,
+ SocketAddress* nat_addr) override;
private:
SocketServer* server_;
diff --git a/webrtc/base/nattypes.cc b/webrtc/base/nattypes.cc
index fedb78d..890a664 100644
--- a/webrtc/base/nattypes.cc
+++ b/webrtc/base/nattypes.cc
@@ -16,30 +16,30 @@
class SymmetricNAT : public NAT {
public:
- bool IsSymmetric() { return true; }
- bool FiltersIP() { return true; }
- bool FiltersPort() { return true; }
+ bool IsSymmetric() override { return true; }
+ bool FiltersIP() override { return true; }
+ bool FiltersPort() override { return true; }
};
class OpenConeNAT : public NAT {
public:
- bool IsSymmetric() { return false; }
- bool FiltersIP() { return false; }
- bool FiltersPort() { return false; }
+ bool IsSymmetric() override { return false; }
+ bool FiltersIP() override { return false; }
+ bool FiltersPort() override { return false; }
};
class AddressRestrictedNAT : public NAT {
public:
- bool IsSymmetric() { return false; }
- bool FiltersIP() { return true; }
- bool FiltersPort() { return false; }
+ bool IsSymmetric() override { return false; }
+ bool FiltersIP() override { return true; }
+ bool FiltersPort() override { return false; }
};
class PortRestrictedNAT : public NAT {
public:
- bool IsSymmetric() { return false; }
- bool FiltersIP() { return true; }
- bool FiltersPort() { return true; }
+ bool IsSymmetric() override { return false; }
+ bool FiltersIP() override { return true; }
+ bool FiltersPort() override { return true; }
};
NAT* NAT::Create(NATType type) {
diff --git a/webrtc/base/nethelpers.cc b/webrtc/base/nethelpers.cc
index 5d4802d..0c7cce6 100644
--- a/webrtc/base/nethelpers.cc
+++ b/webrtc/base/nethelpers.cc
@@ -60,6 +60,8 @@
AsyncResolver::AsyncResolver() : error_(-1) {
}
+AsyncResolver::~AsyncResolver() = default;
+
void AsyncResolver::Start(const SocketAddress& addr) {
addr_ = addr;
// SignalThred Start will kickoff the resolve process.
@@ -80,6 +82,14 @@
return false;
}
+int AsyncResolver::GetError() const {
+ return error_;
+}
+
+void AsyncResolver::Destroy(bool wait) {
+ SignalThread::Destroy(wait);
+}
+
void AsyncResolver::DoWork() {
error_ = ResolveHostname(addr_.hostname().c_str(), addr_.family(),
&addresses_);
diff --git a/webrtc/base/nethelpers.h b/webrtc/base/nethelpers.h
index d39400c..2c72c0b 100644
--- a/webrtc/base/nethelpers.h
+++ b/webrtc/base/nethelpers.h
@@ -34,19 +34,19 @@
class AsyncResolver : public SignalThread, public AsyncResolverInterface {
public:
AsyncResolver();
- virtual ~AsyncResolver() {}
+ ~AsyncResolver() override;
- virtual void Start(const SocketAddress& addr);
- virtual bool GetResolvedAddress(int family, SocketAddress* addr) const;
- virtual int GetError() const { return error_; }
- virtual void Destroy(bool wait) { SignalThread::Destroy(wait); }
+ void Start(const SocketAddress& addr) override;
+ bool GetResolvedAddress(int family, SocketAddress* addr) const override;
+ int GetError() const override;
+ void Destroy(bool wait) override;
const std::vector<IPAddress>& addresses() const { return addresses_; }
void set_error(int error) { error_ = error; }
protected:
- virtual void DoWork();
- virtual void OnWorkDone();
+ void DoWork() override;
+ void OnWorkDone() override;
private:
SocketAddress addr_;
diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc
index 613dcad..9ed1c87 100644
--- a/webrtc/base/network.cc
+++ b/webrtc/base/network.cc
@@ -708,6 +708,8 @@
ignored_(false), type_(type), preference_(0) {
}
+Network::~Network() = default;
+
// Sets the addresses of this network. Returns true if the address set changed.
// Change detection is short circuited if the changed argument is true.
bool Network::SetIPs(const std::vector<InterfaceAddress>& ips, bool changed) {
diff --git a/webrtc/base/network.h b/webrtc/base/network.h
index 089d86b..69108fe 100644
--- a/webrtc/base/network.h
+++ b/webrtc/base/network.h
@@ -103,10 +103,10 @@
class NetworkManagerBase : public NetworkManager {
public:
NetworkManagerBase();
- virtual ~NetworkManagerBase();
+ ~NetworkManagerBase() override;
- virtual void GetNetworks(std::vector<Network*>* networks) const;
- virtual void GetAnyAddressNetworks(NetworkList* networks);
+ void GetNetworks(std::vector<Network*>* networks) const override;
+ void GetAnyAddressNetworks(NetworkList* networks) override;
bool ipv6_enabled() const { return ipv6_enabled_; }
void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; }
@@ -147,16 +147,16 @@
public MessageHandler {
public:
BasicNetworkManager();
- virtual ~BasicNetworkManager();
+ ~BasicNetworkManager() override;
- virtual void StartUpdating();
- virtual void StopUpdating();
+ void StartUpdating() override;
+ void StopUpdating() override;
// Logs the available networks.
- virtual void DumpNetworks(bool include_ignored);
+ void DumpNetworks(bool include_ignored) override;
// MessageHandler interface.
- virtual void OnMessage(Message* msg);
+ void OnMessage(Message* msg) override;
bool started() { return start_count_ > 0; }
// Sets the network ignore list, which is empty by default. Any network on the
@@ -219,6 +219,7 @@
Network(const std::string& name, const std::string& description,
const IPAddress& prefix, int prefix_length, AdapterType type);
+ ~Network();
// Returns the name of the interface this network is associated wtih.
const std::string& name() const { return name_; }
diff --git a/webrtc/base/nssidentity.cc b/webrtc/base/nssidentity.cc
index 77635a2..b34ce1d 100644
--- a/webrtc/base/nssidentity.cc
+++ b/webrtc/base/nssidentity.cc
@@ -117,6 +117,10 @@
chain_.reset(chain->Copy());
}
+NSSCertificate::~NSSCertificate() {
+ if (certificate_)
+ CERT_DestroyCertificate(certificate_);
+}
NSSCertificate *NSSCertificate::FromPEMString(const std::string &pem_string) {
std::string der;
@@ -329,6 +333,9 @@
return true;
}
+NSSIdentity::NSSIdentity(NSSKeyPair* keypair, NSSCertificate* cert)
+ : keypair_(keypair), certificate_(cert) {
+}
NSSIdentity* NSSIdentity::GenerateInternal(const SSLIdentityParams& params) {
std::string subject_name_string = "CN=" + params.common_name;
@@ -495,6 +502,10 @@
return new NSSIdentity(keypair.release(), cert.release());
}
+NSSIdentity::~NSSIdentity() {
+ LOG(LS_INFO) << "Destroying NSS identity";
+}
+
NSSIdentity *NSSIdentity::GetReference() const {
NSSKeyPair *keypair = keypair_->GetReference();
if (!keypair)
diff --git a/webrtc/base/nssidentity.h b/webrtc/base/nssidentity.h
index 2c56c00..bf0a15a 100644
--- a/webrtc/base/nssidentity.h
+++ b/webrtc/base/nssidentity.h
@@ -53,25 +53,22 @@
// and the constructor makes a copy.
explicit NSSCertificate(CERTCertificate* cert);
explicit NSSCertificate(CERTCertList* cert_list);
- virtual ~NSSCertificate() {
- if (certificate_)
- CERT_DestroyCertificate(certificate_);
- }
+ ~NSSCertificate() override;
- virtual NSSCertificate* GetReference() const;
+ NSSCertificate* GetReference() const override;
- virtual std::string ToPEMString() const;
+ std::string ToPEMString() const override;
- virtual void ToDER(Buffer* der_buffer) const;
+ void ToDER(Buffer* der_buffer) const override;
- virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const;
+ bool GetSignatureDigestAlgorithm(std::string* algorithm) const override;
- virtual bool ComputeDigest(const std::string& algorithm,
- unsigned char* digest,
- size_t size,
- size_t* length) const;
+ bool ComputeDigest(const std::string& algorithm,
+ unsigned char* digest,
+ size_t size,
+ size_t* length) const override;
- virtual bool GetChain(SSLCertChain** chain) const;
+ bool GetChain(SSLCertChain** chain) const override;
CERTCertificate* certificate() { return certificate_; }
@@ -104,18 +101,15 @@
static NSSIdentity* GenerateForTest(const SSLIdentityParams& params);
static SSLIdentity* FromPEMStrings(const std::string& private_key,
const std::string& certificate);
- virtual ~NSSIdentity() {
- LOG(LS_INFO) << "Destroying NSS identity";
- }
+ ~NSSIdentity() override;
- virtual NSSIdentity* GetReference() const;
- virtual NSSCertificate& certificate() const;
+ NSSIdentity* GetReference() const override;
+ NSSCertificate& certificate() const override;
NSSKeyPair* keypair() const { return keypair_.get(); }
private:
- NSSIdentity(NSSKeyPair* keypair, NSSCertificate* cert) :
- keypair_(keypair), certificate_(cert) {}
+ NSSIdentity(NSSKeyPair* keypair, NSSCertificate* cert);
static NSSIdentity* GenerateInternal(const SSLIdentityParams& params);
diff --git a/webrtc/base/nssstreamadapter.cc b/webrtc/base/nssstreamadapter.cc
index 1286bf9..044d00b 100644
--- a/webrtc/base/nssstreamadapter.cc
+++ b/webrtc/base/nssstreamadapter.cc
@@ -614,6 +614,11 @@
Thread::Current()->Clear(this, MSG_DTLS_TIMEOUT);
}
+bool NSSStreamAdapter::GetDigestLength(const std::string& algorithm,
+ size_t* length) {
+ return NSSCertificate::GetDigestLength(algorithm, length);
+}
+
StreamResult NSSStreamAdapter::Read(void* data, size_t data_len,
size_t* read, int* error) {
// SSL_CONNECTED sanity check.
diff --git a/webrtc/base/nssstreamadapter.h b/webrtc/base/nssstreamadapter.h
index afa2eb6..8b58885 100644
--- a/webrtc/base/nssstreamadapter.h
+++ b/webrtc/base/nssstreamadapter.h
@@ -52,28 +52,32 @@
class NSSStreamAdapter : public SSLStreamAdapterHelper {
public:
explicit NSSStreamAdapter(StreamInterface* stream);
- virtual ~NSSStreamAdapter();
+ ~NSSStreamAdapter() override;
bool Init();
- virtual StreamResult Read(void* data, size_t data_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- void OnMessage(Message *msg);
+ StreamResult Read(void* data,
+ size_t data_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void OnMessage(Message* msg) override;
- virtual bool GetSslCipher(std::string* cipher);
+ bool GetSslCipher(std::string* cipher) override;
// Key Extractor interface
- virtual bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
- size_t context_len,
- bool use_context,
- uint8* result,
- size_t result_len);
+ bool ExportKeyingMaterial(const std::string& label,
+ const uint8* context,
+ size_t context_len,
+ bool use_context,
+ uint8* result,
+ size_t result_len) override;
// DTLS-SRTP interface
- virtual bool SetDtlsSrtpCiphers(const std::vector<std::string>& ciphers);
- virtual bool GetDtlsSrtpCipher(std::string* cipher);
+ bool SetDtlsSrtpCiphers(const std::vector<std::string>& ciphers) override;
+ bool GetDtlsSrtpCipher(std::string* cipher) override;
// Capabilities interfaces
static bool HaveDtls();
@@ -83,14 +87,12 @@
protected:
// Override SSLStreamAdapter
- virtual void OnEvent(StreamInterface* stream, int events, int err);
+ void OnEvent(StreamInterface* stream, int events, int err) override;
// Override SSLStreamAdapterHelper
- virtual int BeginSSL();
- virtual void Cleanup();
- virtual bool GetDigestLength(const std::string& algorithm, size_t* length) {
- return NSSCertificate::GetDigestLength(algorithm, length);
- }
+ int BeginSSL() override;
+ void Cleanup() override;
+ bool GetDigestLength(const std::string& algorithm, size_t* length) override;
private:
int ContinueSSL();
diff --git a/webrtc/base/openssladapter.h b/webrtc/base/openssladapter.h
index 079f001..3dcb1c5 100644
--- a/webrtc/base/openssladapter.h
+++ b/webrtc/base/openssladapter.h
@@ -31,24 +31,24 @@
static bool CleanupSSL();
OpenSSLAdapter(AsyncSocket* socket);
- virtual ~OpenSSLAdapter();
+ ~OpenSSLAdapter() override;
- virtual void SetMode(SSLMode mode);
- virtual int StartSSL(const char* hostname, bool restartable);
- virtual int Send(const void* pv, size_t cb);
- virtual int SendTo(const void* pv, size_t cb, const SocketAddress& addr);
- virtual int Recv(void* pv, size_t cb);
- virtual int RecvFrom(void* pv, size_t cb, SocketAddress* paddr);
- virtual int Close();
+ void SetMode(SSLMode mode) override;
+ int StartSSL(const char* hostname, bool restartable) override;
+ int Send(const void* pv, size_t cb) override;
+ int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
+ int Recv(void* pv, size_t cb) override;
+ int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override;
+ int Close() override;
// Note that the socket returns ST_CONNECTING while SSL is being negotiated.
- virtual ConnState GetState() const;
+ ConnState GetState() const override;
protected:
- virtual void OnConnectEvent(AsyncSocket* socket);
- virtual void OnReadEvent(AsyncSocket* socket);
- virtual void OnWriteEvent(AsyncSocket* socket);
- virtual void OnCloseEvent(AsyncSocket* socket, int err);
+ void OnConnectEvent(AsyncSocket* socket) override;
+ void OnReadEvent(AsyncSocket* socket) override;
+ void OnWriteEvent(AsyncSocket* socket) override;
+ void OnCloseEvent(AsyncSocket* socket, int err) override;
private:
enum SSLState {
@@ -62,7 +62,7 @@
void Error(const char* context, int err, bool signal = true);
void Cleanup();
- virtual void OnMessage(Message* msg);
+ void OnMessage(Message* msg) override;
static bool VerifyServerName(SSL* ssl, const char* host,
bool ignore_bad_cert);
diff --git a/webrtc/base/openssldigest.h b/webrtc/base/openssldigest.h
index c4b0d8a..413df45 100644
--- a/webrtc/base/openssldigest.h
+++ b/webrtc/base/openssldigest.h
@@ -22,13 +22,13 @@
public:
// Creates an OpenSSLDigest with |algorithm| as the hash algorithm.
explicit OpenSSLDigest(const std::string& algorithm);
- ~OpenSSLDigest();
+ ~OpenSSLDigest() override;
// Returns the digest output size (e.g. 16 bytes for MD5).
- virtual size_t Size() const;
+ size_t Size() const override;
// Updates the digest with |len| bytes from |buf|.
- virtual void Update(const void* buf, size_t len);
+ void Update(const void* buf, size_t len) override;
// Outputs the digest value to |buf| with length |len|.
- virtual size_t Finish(void* buf, size_t len);
+ size_t Finish(void* buf, size_t len) override;
// Helper function to look up a digest's EVP by name.
static bool GetDigestEVP(const std::string &algorithm,
diff --git a/webrtc/base/opensslidentity.cc b/webrtc/base/opensslidentity.cc
index 30ac6e2..39ae22a 100644
--- a/webrtc/base/opensslidentity.cc
+++ b/webrtc/base/opensslidentity.cc
@@ -151,6 +151,11 @@
EVP_PKEY_free(pkey_);
}
+OpenSSLKeyPair* OpenSSLKeyPair::GetReference() {
+ AddReference();
+ return new OpenSSLKeyPair(pkey_);
+}
+
void OpenSSLKeyPair::AddReference() {
CRYPTO_add(&pkey_->references, 1, CRYPTO_LOCK_EVP_PKEY);
}
@@ -218,6 +223,13 @@
EVP_get_digestbyobj(x509_->sig_alg->algorithm), algorithm);
}
+bool OpenSSLCertificate::GetChain(SSLCertChain** chain) const {
+ // Chains are not yet supported when using OpenSSL.
+ // OpenSSLStreamAdapter::SSLVerifyCallback currently requires the remote
+ // certificate to be self-signed.
+ return false;
+}
+
bool OpenSSLCertificate::ComputeDigest(const std::string& algorithm,
unsigned char* digest,
size_t size,
@@ -250,6 +262,10 @@
X509_free(x509_);
}
+OpenSSLCertificate* OpenSSLCertificate::GetReference() const {
+ return new OpenSSLCertificate(x509_);
+}
+
std::string OpenSSLCertificate::ToPEMString() const {
BIO* bio = BIO_new(BIO_s_mem());
if (!bio) {
@@ -291,6 +307,15 @@
CRYPTO_add(&x509_->references, 1, CRYPTO_LOCK_X509);
}
+OpenSSLIdentity::OpenSSLIdentity(OpenSSLKeyPair* key_pair,
+ OpenSSLCertificate* certificate)
+ : key_pair_(key_pair), certificate_(certificate) {
+ ASSERT(key_pair != NULL);
+ ASSERT(certificate != NULL);
+}
+
+OpenSSLIdentity::~OpenSSLIdentity() = default;
+
OpenSSLIdentity* OpenSSLIdentity::GenerateInternal(
const SSLIdentityParams& params) {
OpenSSLKeyPair *key_pair = OpenSSLKeyPair::Generate();
@@ -347,6 +372,15 @@
cert.release());
}
+const OpenSSLCertificate& OpenSSLIdentity::certificate() const {
+ return *certificate_;
+}
+
+OpenSSLIdentity* OpenSSLIdentity::GetReference() const {
+ return new OpenSSLIdentity(key_pair_->GetReference(),
+ certificate_->GetReference());
+}
+
bool OpenSSLIdentity::ConfigureIdentity(SSL_CTX* ctx) {
// 1 is the documented success return code.
if (SSL_CTX_use_certificate(ctx, certificate_->x509()) != 1 ||
diff --git a/webrtc/base/opensslidentity.h b/webrtc/base/opensslidentity.h
index e52cd10..71a2c31 100644
--- a/webrtc/base/opensslidentity.h
+++ b/webrtc/base/opensslidentity.h
@@ -36,10 +36,7 @@
virtual ~OpenSSLKeyPair();
- virtual OpenSSLKeyPair* GetReference() {
- AddReference();
- return new OpenSSLKeyPair(pkey_);
- }
+ virtual OpenSSLKeyPair* GetReference();
EVP_PKEY* pkey() const { return pkey_; }
@@ -64,23 +61,21 @@
const SSLIdentityParams& params);
static OpenSSLCertificate* FromPEMString(const std::string& pem_string);
- virtual ~OpenSSLCertificate();
+ ~OpenSSLCertificate() override;
- virtual OpenSSLCertificate* GetReference() const {
- return new OpenSSLCertificate(x509_);
- }
+ OpenSSLCertificate* GetReference() const override;
X509* x509() const { return x509_; }
- virtual std::string ToPEMString() const;
+ std::string ToPEMString() const override;
- virtual void ToDER(Buffer* der_buffer) const;
+ void ToDER(Buffer* der_buffer) const override;
// Compute the digest of the certificate given algorithm
- virtual bool ComputeDigest(const std::string& algorithm,
- unsigned char* digest,
- size_t size,
- size_t* length) const;
+ bool ComputeDigest(const std::string& algorithm,
+ unsigned char* digest,
+ size_t size,
+ size_t* length) const override;
// Compute the digest of a certificate as an X509 *
static bool ComputeDigest(const X509* x509,
@@ -89,14 +84,8 @@
size_t size,
size_t* length);
- virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const;
-
- virtual bool GetChain(SSLCertChain** chain) const {
- // Chains are not yet supported when using OpenSSL.
- // OpenSSLStreamAdapter::SSLVerifyCallback currently requires the remote
- // certificate to be self-signed.
- return false;
- }
+ bool GetSignatureDigestAlgorithm(std::string* algorithm) const override;
+ bool GetChain(SSLCertChain** chain) const override;
private:
void AddReference() const;
@@ -114,27 +103,16 @@
static OpenSSLIdentity* GenerateForTest(const SSLIdentityParams& params);
static SSLIdentity* FromPEMStrings(const std::string& private_key,
const std::string& certificate);
- virtual ~OpenSSLIdentity() { }
+ ~OpenSSLIdentity() override;
- virtual const OpenSSLCertificate& certificate() const {
- return *certificate_;
- }
-
- virtual OpenSSLIdentity* GetReference() const {
- return new OpenSSLIdentity(key_pair_->GetReference(),
- certificate_->GetReference());
- }
+ const OpenSSLCertificate& certificate() const override;
+ OpenSSLIdentity* GetReference() const override;
// Configure an SSL context object to use our key and certificate.
bool ConfigureIdentity(SSL_CTX* ctx);
private:
- OpenSSLIdentity(OpenSSLKeyPair* key_pair,
- OpenSSLCertificate* certificate)
- : key_pair_(key_pair), certificate_(certificate) {
- ASSERT(key_pair != NULL);
- ASSERT(certificate != NULL);
- }
+ OpenSSLIdentity(OpenSSLKeyPair* key_pair, OpenSSLCertificate* certificate);
static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params);
diff --git a/webrtc/base/opensslstreamadapter.h b/webrtc/base/opensslstreamadapter.h
index ea0fb59..6b24c9b 100644
--- a/webrtc/base/opensslstreamadapter.h
+++ b/webrtc/base/opensslstreamadapter.h
@@ -59,48 +59,51 @@
class OpenSSLStreamAdapter : public SSLStreamAdapter {
public:
explicit OpenSSLStreamAdapter(StreamInterface* stream);
- virtual ~OpenSSLStreamAdapter();
+ ~OpenSSLStreamAdapter() override;
- virtual void SetIdentity(SSLIdentity* identity);
+ void SetIdentity(SSLIdentity* identity) override;
// Default argument is for compatibility
- virtual void SetServerRole(SSLRole role = SSL_SERVER);
- virtual bool SetPeerCertificateDigest(const std::string& digest_alg,
- const unsigned char* digest_val,
- size_t digest_len);
+ void SetServerRole(SSLRole role = SSL_SERVER) override;
+ bool SetPeerCertificateDigest(const std::string& digest_alg,
+ const unsigned char* digest_val,
+ size_t digest_len) override;
- virtual bool GetPeerCertificate(SSLCertificate** cert) const;
+ bool GetPeerCertificate(SSLCertificate** cert) const override;
- virtual int StartSSLWithServer(const char* server_name);
- virtual int StartSSLWithPeer();
- virtual void SetMode(SSLMode mode);
+ int StartSSLWithServer(const char* server_name) override;
+ int StartSSLWithPeer() override;
+ void SetMode(SSLMode mode) override;
- virtual StreamResult Read(void* data, size_t data_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
- virtual StreamState GetState() const;
+ StreamResult Read(void* data,
+ size_t data_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
+ StreamState GetState() const override;
#ifndef OPENSSL_IS_BORINGSSL
// Return the RFC (5246, 3268, etc.) cipher name for an OpenSSL cipher.
static const char* GetRfcSslCipherName(const SSL_CIPHER* cipher);
#endif
- virtual bool GetSslCipher(std::string* cipher);
+ bool GetSslCipher(std::string* cipher) override;
// Key Extractor interface
- virtual bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
- size_t context_len,
- bool use_context,
- uint8* result,
- size_t result_len);
-
+ bool ExportKeyingMaterial(const std::string& label,
+ const uint8* context,
+ size_t context_len,
+ bool use_context,
+ uint8* result,
+ size_t result_len) override;
// DTLS-SRTP interface
- virtual bool SetDtlsSrtpCiphers(const std::vector<std::string>& ciphers);
- virtual bool GetDtlsSrtpCipher(std::string* cipher);
+ bool SetDtlsSrtpCiphers(const std::vector<std::string>& ciphers) override;
+ bool GetDtlsSrtpCipher(std::string* cipher) override;
// Capabilities interfaces
static bool HaveDtls();
@@ -109,7 +112,7 @@
static std::string GetDefaultSslCipher();
protected:
- virtual void OnEvent(StreamInterface* stream, int events, int err);
+ void OnEvent(StreamInterface* stream, int events, int err) override;
private:
enum SSLState {
@@ -149,7 +152,7 @@
void Cleanup();
// Override MessageHandler
- virtual void OnMessage(Message* msg);
+ void OnMessage(Message* msg) override;
// Flush the input buffers by reading left bytes (for DTLS)
void FlushInput(unsigned int left);
diff --git a/webrtc/base/optionsfile.cc b/webrtc/base/optionsfile.cc
index d84c948..ae37877 100644
--- a/webrtc/base/optionsfile.cc
+++ b/webrtc/base/optionsfile.cc
@@ -21,6 +21,8 @@
OptionsFile::OptionsFile(const std::string &path) : path_(path) {
}
+OptionsFile::~OptionsFile() = default;
+
bool OptionsFile::Load() {
options_.clear();
// Open file.
diff --git a/webrtc/base/optionsfile.h b/webrtc/base/optionsfile.h
index c740ce4..9eb484e 100644
--- a/webrtc/base/optionsfile.h
+++ b/webrtc/base/optionsfile.h
@@ -22,6 +22,7 @@
class OptionsFile {
public:
OptionsFile(const std::string &path);
+ ~OptionsFile();
// Loads the file from disk, overwriting the in-memory values.
bool Load();
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index 28b4103..bc3fb32 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -120,7 +120,7 @@
}
}
- virtual ~PhysicalSocket() {
+ ~PhysicalSocket() override {
Close();
}
@@ -135,7 +135,7 @@
return s_ != INVALID_SOCKET;
}
- SocketAddress GetLocalAddress() const {
+ SocketAddress GetLocalAddress() const override {
sockaddr_storage addr_storage = {0};
socklen_t addrlen = sizeof(addr_storage);
sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
@@ -150,7 +150,7 @@
return address;
}
- SocketAddress GetRemoteAddress() const {
+ SocketAddress GetRemoteAddress() const override {
sockaddr_storage addr_storage = {0};
socklen_t addrlen = sizeof(addr_storage);
sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
@@ -165,7 +165,7 @@
return address;
}
- int Bind(const SocketAddress& bind_addr) {
+ int Bind(const SocketAddress& bind_addr) override {
sockaddr_storage addr_storage;
size_t len = bind_addr.ToSockAddrStorage(&addr_storage);
sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
@@ -180,7 +180,7 @@
return err;
}
- int Connect(const SocketAddress& addr) {
+ int Connect(const SocketAddress& addr) override {
// TODO: Implicit creation is required to reconnect...
// ...but should we make it more explicit?
if (state_ != CS_CLOSED) {
@@ -222,21 +222,19 @@
return 0;
}
- int GetError() const {
+ int GetError() const override {
CritScope cs(&crit_);
return error_;
}
- void SetError(int error) {
+ void SetError(int error) override {
CritScope cs(&crit_);
error_ = error;
}
- ConnState GetState() const {
- return state_;
- }
+ ConnState GetState() const override { return state_; }
- int GetOption(Option opt, int* value) {
+ int GetOption(Option opt, int* value) override {
int slevel;
int sopt;
if (TranslateOption(opt, &slevel, &sopt) == -1)
@@ -251,7 +249,7 @@
return ret;
}
- int SetOption(Option opt, int value) {
+ int SetOption(Option opt, int value) override {
int slevel;
int sopt;
if (TranslateOption(opt, &slevel, &sopt) == -1)
@@ -264,7 +262,7 @@
return ::setsockopt(s_, slevel, sopt, (SockOptArg)&value, sizeof(value));
}
- int Send(const void *pv, size_t cb) {
+ int Send(const void* pv, size_t cb) override {
int sent = ::send(s_, reinterpret_cast<const char *>(pv), (int)cb,
#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
// Suppress SIGPIPE. Without this, attempting to send on a socket whose
@@ -287,7 +285,9 @@
return sent;
}
- int SendTo(const void* buffer, size_t length, const SocketAddress& addr) {
+ int SendTo(const void* buffer,
+ size_t length,
+ const SocketAddress& addr) override {
sockaddr_storage saddr;
size_t len = addr.ToSockAddrStorage(&saddr);
int sent = ::sendto(
@@ -309,7 +309,7 @@
return sent;
}
- int Recv(void* buffer, size_t length) {
+ int Recv(void* buffer, size_t length) override {
int received = ::recv(s_, static_cast<char*>(buffer),
static_cast<int>(length), 0);
if ((received == 0) && (length != 0)) {
@@ -335,7 +335,7 @@
return received;
}
- int RecvFrom(void* buffer, size_t length, SocketAddress *out_addr) {
+ int RecvFrom(void* buffer, size_t length, SocketAddress* out_addr) override {
sockaddr_storage addr_storage;
socklen_t addr_len = sizeof(addr_storage);
sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
@@ -355,7 +355,7 @@
return received;
}
- int Listen(int backlog) {
+ int Listen(int backlog) override {
int err = ::listen(s_, backlog);
UpdateLastError();
if (err == 0) {
@@ -369,7 +369,7 @@
return err;
}
- AsyncSocket* Accept(SocketAddress *out_addr) {
+ AsyncSocket* Accept(SocketAddress* out_addr) override {
sockaddr_storage addr_storage;
socklen_t addr_len = sizeof(addr_storage);
sockaddr* addr = reinterpret_cast<sockaddr*>(&addr_storage);
@@ -383,7 +383,7 @@
return ss_->WrapSocket(s);
}
- int Close() {
+ int Close() override {
if (s_ == INVALID_SOCKET)
return 0;
int err = ::closesocket(s_);
@@ -398,7 +398,7 @@
return err;
}
- int EstimateMTU(uint16* mtu) {
+ int EstimateMTU(uint16* mtu) override {
SocketAddress addr = GetRemoteAddress();
if (addr.IsAny()) {
SetError(ENOTCONN);
@@ -563,7 +563,7 @@
ss_->Add(this);
}
- virtual ~EventDispatcher() {
+ ~EventDispatcher() override {
ss_->Remove(this);
close(afd_[0]);
close(afd_[1]);
@@ -579,11 +579,9 @@
}
}
- virtual uint32 GetRequestedEvents() {
- return DE_READ;
- }
+ uint32 GetRequestedEvents() override { return DE_READ; }
- virtual void OnPreEvent(uint32 ff) {
+ void OnPreEvent(uint32 ff) override {
// It is not possible to perfectly emulate an auto-resetting event with
// pipes. This simulates it by resetting before the event is handled.
@@ -595,17 +593,11 @@
}
}
- virtual void OnEvent(uint32 ff, int err) {
- ASSERT(false);
- }
+ void OnEvent(uint32 ff, int err) override { ASSERT(false); }
- virtual int GetDescriptor() {
- return afd_[0];
- }
+ int GetDescriptor() override { return afd_[0]; }
- virtual bool IsDescriptorClosed() {
- return false;
- }
+ bool IsDescriptorClosed() override { return false; }
private:
PhysicalSocketServer *ss_;
@@ -735,15 +727,13 @@
owner_->Add(this);
}
- virtual ~PosixSignalDispatcher() {
+ ~PosixSignalDispatcher() override {
owner_->Remove(this);
}
- virtual uint32 GetRequestedEvents() {
- return DE_READ;
- }
+ uint32 GetRequestedEvents() override { return DE_READ; }
- virtual void OnPreEvent(uint32 ff) {
+ void OnPreEvent(uint32 ff) override {
// Events might get grouped if signals come very fast, so we read out up to
// 16 bytes to make sure we keep the pipe empty.
uint8 b[16];
@@ -755,7 +745,7 @@
}
}
- virtual void OnEvent(uint32 ff, int err) {
+ void OnEvent(uint32 ff, int err) override {
for (int signum = 0; signum < PosixSignalHandler::kNumPosixSignals;
++signum) {
if (PosixSignalHandler::Instance()->IsSignalSet(signum)) {
@@ -774,13 +764,11 @@
}
}
- virtual int GetDescriptor() {
+ int GetDescriptor() override {
return PosixSignalHandler::Instance()->GetDescriptor();
}
- virtual bool IsDescriptorClosed() {
- return false;
- }
+ bool IsDescriptorClosed() override { return false; }
void SetHandler(int signum, void (*handler)(int)) {
handlers_[signum] = handler;
@@ -809,7 +797,7 @@
SocketDispatcher(SOCKET s, PhysicalSocketServer *ss) : PhysicalSocket(ss, s) {
}
- virtual ~SocketDispatcher() {
+ ~SocketDispatcher() override {
Close();
}
@@ -823,7 +811,7 @@
return Create(AF_INET, type);
}
- virtual bool Create(int family, int type) {
+ bool Create(int family, int type) override {
// Change the socket to be non-blocking.
if (!PhysicalSocket::Create(family, type))
return false;
@@ -831,11 +819,9 @@
return Initialize();
}
- virtual int GetDescriptor() {
- return s_;
- }
+ int GetDescriptor() override { return s_; }
- virtual bool IsDescriptorClosed() {
+ bool IsDescriptorClosed() override {
// We don't have a reliable way of distinguishing end-of-stream
// from readability. So test on each readable call. Is this
// inefficient? Probably.
@@ -870,18 +856,16 @@
}
}
- virtual uint32 GetRequestedEvents() {
- return enabled_events_;
- }
+ uint32 GetRequestedEvents() override { return enabled_events_; }
- virtual void OnPreEvent(uint32 ff) {
+ void OnPreEvent(uint32 ff) override {
if ((ff & DE_CONNECT) != 0)
state_ = CS_CONNECTED;
if ((ff & DE_CLOSE) != 0)
state_ = CS_CLOSED;
}
- virtual void OnEvent(uint32 ff, int err) {
+ void OnEvent(uint32 ff, int err) override {
// Make sure we deliver connect/accept first. Otherwise, consumers may see
// something like a READ followed by a CONNECT, which would be odd.
if ((ff & DE_CONNECT) != 0) {
@@ -907,7 +891,7 @@
}
}
- virtual int Close() {
+ int Close() override {
if (s_ == INVALID_SOCKET)
return 0;
@@ -926,28 +910,21 @@
fcntl(fd_, F_SETFL, fcntl(fd_, F_GETFL, 0) | O_NONBLOCK);
}
- virtual ~FileDispatcher() {
+ ~FileDispatcher() override {
ss_->Remove(this);
}
SocketServer* socketserver() { return ss_; }
- virtual int GetDescriptor() {
- return fd_;
- }
+ int GetDescriptor() override { return fd_; }
- virtual bool IsDescriptorClosed() {
- return false;
- }
+ bool IsDescriptorClosed() override { return false; }
- virtual uint32 GetRequestedEvents() {
- return flags_;
- }
+ uint32 GetRequestedEvents() override { return flags_; }
- virtual void OnPreEvent(uint32 ff) {
- }
+ void OnPreEvent(uint32 ff) override {}
- virtual void OnEvent(uint32 ff, int err) {
+ void OnEvent(uint32 ff, int err) override {
if ((ff & DE_READ) != 0)
SignalReadEvent(this);
if ((ff & DE_WRITE) != 0)
@@ -956,19 +933,15 @@
SignalCloseEvent(this, err);
}
- virtual bool readable() {
- return (flags_ & DE_READ) != 0;
- }
+ bool readable() override { return (flags_ & DE_READ) != 0; }
- virtual void set_readable(bool value) {
+ void set_readable(bool value) override {
flags_ = value ? (flags_ | DE_READ) : (flags_ & ~DE_READ);
}
- virtual bool writable() {
- return (flags_ & DE_WRITE) != 0;
- }
+ bool writable() override { return (flags_ & DE_WRITE) != 0; }
- virtual void set_writable(bool value) {
+ void set_writable(bool value) override {
flags_ = value ? (flags_ | DE_WRITE) : (flags_ & ~DE_WRITE);
}
@@ -1179,9 +1152,9 @@
Signaler(PhysicalSocketServer* ss, bool* pf)
: EventDispatcher(ss), pf_(pf) {
}
- virtual ~Signaler() { }
+ ~Signaler() override { }
- void OnEvent(uint32 ff, int err) {
+ void OnEvent(uint32 ff, int err) override {
if (pf_)
*pf_ = false;
}
diff --git a/webrtc/base/physicalsocketserver.h b/webrtc/base/physicalsocketserver.h
index 8a289de..15be789 100644
--- a/webrtc/base/physicalsocketserver.h
+++ b/webrtc/base/physicalsocketserver.h
@@ -58,21 +58,21 @@
class PhysicalSocketServer : public SocketServer {
public:
PhysicalSocketServer();
- virtual ~PhysicalSocketServer();
+ ~PhysicalSocketServer() override;
// SocketFactory:
- virtual Socket* CreateSocket(int type);
- virtual Socket* CreateSocket(int family, int type);
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
// Internal Factory for Accept
AsyncSocket* WrapSocket(SOCKET s);
// SocketServer:
- virtual bool Wait(int cms, bool process_io);
- virtual void WakeUp();
+ bool Wait(int cms, bool process_io) override;
+ void WakeUp() override;
void Add(Dispatcher* dispatcher);
void Remove(Dispatcher* dispatcher);
diff --git a/webrtc/base/profiler.cc b/webrtc/base/profiler.cc
index a71f050..e0bd431 100644
--- a/webrtc/base/profiler.cc
+++ b/webrtc/base/profiler.cc
@@ -86,11 +86,16 @@
return sqrt(sum_of_squared_differences_ / (event_count_ - 1.0));
}
+Profiler::~Profiler() = default;
+
Profiler* Profiler::Instance() {
LIBJINGLE_DEFINE_STATIC_LOCAL(Profiler, instance, ());
return &instance;
}
+Profiler::Profiler() {
+}
+
void Profiler::StartEvent(const std::string& event_name) {
lock_.LockShared();
EventMap::iterator it = events_.find(event_name);
diff --git a/webrtc/base/profiler.h b/webrtc/base/profiler.h
index 13b99f7..6289035 100644
--- a/webrtc/base/profiler.h
+++ b/webrtc/base/profiler.h
@@ -115,6 +115,7 @@
// macros, defined above, rather than directly calling Profiler methods.
class Profiler {
public:
+ ~Profiler();
void StartEvent(const std::string& event_name);
void StopEvent(const std::string& event_name);
void ReportToLog(const char* file, int line, LoggingSeverity severity_to_use,
@@ -127,7 +128,7 @@
static Profiler* Instance();
private:
- Profiler() {}
+ Profiler();
typedef std::map<std::string, ProfilerEvent> EventMap;
EventMap events_;
diff --git a/webrtc/base/proxyinfo.cc b/webrtc/base/proxyinfo.cc
index 70c3b55..76c7708 100644
--- a/webrtc/base/proxyinfo.cc
+++ b/webrtc/base/proxyinfo.cc
@@ -17,4 +17,8 @@
return PROXY_NAMES[proxy];
}
+ProxyInfo::ProxyInfo() : type(PROXY_NONE), autodetect(false) {
+}
+ProxyInfo::~ProxyInfo() = default;
+
} // namespace rtc
diff --git a/webrtc/base/proxyinfo.h b/webrtc/base/proxyinfo.h
index 9947f45..2251b13 100644
--- a/webrtc/base/proxyinfo.h
+++ b/webrtc/base/proxyinfo.h
@@ -34,7 +34,8 @@
std::string username;
CryptString password;
- ProxyInfo() : type(PROXY_NONE), autodetect(false) { }
+ ProxyInfo();
+ ~ProxyInfo();
};
} // namespace rtc
diff --git a/webrtc/base/proxyserver.cc b/webrtc/base/proxyserver.cc
index a17983d..8f12a99 100644
--- a/webrtc/base/proxyserver.cc
+++ b/webrtc/base/proxyserver.cc
@@ -74,6 +74,8 @@
ext_socket_->SignalCloseEvent.connect(this, &ProxyBinding::OnExternalClose);
}
+ProxyBinding::~ProxyBinding() = default;
+
void ProxyBinding::OnConnectRequest(AsyncProxyServerSocket* socket,
const SocketAddress& addr) {
ASSERT(!connected_ && ext_socket_.get() != NULL);
@@ -141,4 +143,8 @@
SignalDestroyed(this);
}
+AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) {
+ return new AsyncSocksProxyServerSocket(socket);
+}
+
} // namespace rtc
diff --git a/webrtc/base/proxyserver.h b/webrtc/base/proxyserver.h
index 80e15d9..5418a97 100644
--- a/webrtc/base/proxyserver.h
+++ b/webrtc/base/proxyserver.h
@@ -31,6 +31,7 @@
class ProxyBinding : public sigslot::has_slots<> {
public:
ProxyBinding(AsyncProxyServerSocket* in_socket, AsyncSocket* out_socket);
+ ~ProxyBinding() override;
sigslot::signal1<ProxyBinding*> SignalDestroyed;
private:
@@ -61,7 +62,7 @@
public:
ProxyServer(SocketFactory* int_factory, const SocketAddress& int_addr,
SocketFactory* ext_factory, const SocketAddress& ext_ip);
- virtual ~ProxyServer();
+ ~ProxyServer() override;
protected:
void OnAcceptEvent(AsyncSocket* socket);
@@ -85,9 +86,7 @@
: ProxyServer(int_factory, int_addr, ext_factory, ext_ip) {
}
protected:
- AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) {
- return new AsyncSocksProxyServerSocket(socket);
- }
+ AsyncProxyServerSocket* WrapSocket(AsyncSocket* socket) override;
DISALLOW_EVIL_CONSTRUCTORS(SocksProxyServer);
};
diff --git a/webrtc/base/sha1digest.cc b/webrtc/base/sha1digest.cc
new file mode 100644
index 0000000..5ba0c54
--- /dev/null
+++ b/webrtc/base/sha1digest.cc
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/sha1digest.h"
+
+namespace rtc {
+
+size_t Sha1Digest::Size() const {
+ return kSize;
+}
+
+void Sha1Digest::Update(const void* buf, size_t len) {
+ SHA1Update(&ctx_, static_cast<const uint8*>(buf), len);
+}
+
+size_t Sha1Digest::Finish(void* buf, size_t len) {
+ if (len < kSize) {
+ return 0;
+ }
+ SHA1Final(&ctx_, static_cast<uint8*>(buf));
+ SHA1Init(&ctx_); // Reset for next use.
+ return kSize;
+}
+
+} // namespace rtc
diff --git a/webrtc/base/sha1digest.h b/webrtc/base/sha1digest.h
index fb4c53e..d321cb8 100644
--- a/webrtc/base/sha1digest.h
+++ b/webrtc/base/sha1digest.h
@@ -23,20 +23,9 @@
Sha1Digest() {
SHA1Init(&ctx_);
}
- virtual size_t Size() const {
- return kSize;
- }
- virtual void Update(const void* buf, size_t len) {
- SHA1Update(&ctx_, static_cast<const uint8*>(buf), len);
- }
- virtual size_t Finish(void* buf, size_t len) {
- if (len < kSize) {
- return 0;
- }
- SHA1Final(&ctx_, static_cast<uint8*>(buf));
- SHA1Init(&ctx_); // Reset for next use.
- return kSize;
- }
+ size_t Size() const override;
+ void Update(const void* buf, size_t len) override;
+ size_t Finish(void* buf, size_t len) override;
private:
SHA1_CTX ctx_;
diff --git a/webrtc/base/signalthread.cc b/webrtc/base/signalthread.cc
index f95cb5f..d03f386 100644
--- a/webrtc/base/signalthread.cc
+++ b/webrtc/base/signalthread.cc
@@ -131,6 +131,14 @@
}
}
+SignalThread::Worker::~Worker() {
+ Stop();
+}
+
+void SignalThread::Worker::Run() {
+ parent_->Run();
+}
+
void SignalThread::Run() {
DoWork();
{
diff --git a/webrtc/base/signalthread.h b/webrtc/base/signalthread.h
index 8e18be6..3a9205c 100644
--- a/webrtc/base/signalthread.h
+++ b/webrtc/base/signalthread.h
@@ -69,7 +69,7 @@
enum { ST_MSG_WORKER_DONE, ST_MSG_FIRST_AVAILABLE };
protected:
- virtual ~SignalThread();
+ ~SignalThread() override;
Thread* worker() { return &worker_; }
@@ -92,7 +92,7 @@
// Context: Any Thread. If subclass overrides, be sure to call the base
// implementation. Do not use (message_id < ST_MSG_FIRST_AVAILABLE)
- virtual void OnMessage(Message *msg);
+ void OnMessage(Message* msg) override;
private:
enum State {
@@ -106,8 +106,8 @@
class Worker : public Thread {
public:
explicit Worker(SignalThread* parent) : parent_(parent) {}
- virtual ~Worker() { Stop(); }
- virtual void Run() { parent_->Run(); }
+ ~Worker() override;
+ void Run() override;
private:
SignalThread* parent_;
diff --git a/webrtc/base/sigslot.cc b/webrtc/base/sigslot.cc
new file mode 100644
index 0000000..9628217
--- /dev/null
+++ b/webrtc/base/sigslot.cc
@@ -0,0 +1,54 @@
+// sigslot.h: Signal/Slot classes
+//
+// Written by Sarah Thompson (sarah@telergy.com) 2002.
+//
+// License: Public domain. You are free to use this code however you like, with
+// the proviso that the author takes on no responsibility or liability for any
+// use.
+
+#include "webrtc/base/sigslot.h"
+
+namespace sigslot {
+
+#ifdef _SIGSLOT_HAS_POSIX_THREADS
+
+multi_threaded_global::multi_threaded_global() {
+ pthread_mutex_init(get_mutex(), NULL);
+}
+
+multi_threaded_global::multi_threaded_global(const multi_threaded_global&) {
+}
+
+multi_threaded_global::~multi_threaded_global() = default;
+
+void multi_threaded_global::lock() {
+ pthread_mutex_lock(get_mutex());
+}
+
+void multi_threaded_global::unlock() {
+ pthread_mutex_unlock(get_mutex());
+}
+
+multi_threaded_local::multi_threaded_local() {
+ pthread_mutex_init(&m_mutex, NULL);
+}
+
+multi_threaded_local::multi_threaded_local(const multi_threaded_local&) {
+ pthread_mutex_init(&m_mutex, NULL);
+}
+
+multi_threaded_local::~multi_threaded_local() {
+ pthread_mutex_destroy(&m_mutex);
+}
+
+void multi_threaded_local::lock() {
+ pthread_mutex_lock(&m_mutex);
+}
+
+void multi_threaded_local::unlock() {
+ pthread_mutex_unlock(&m_mutex);
+}
+
+#endif // _SIGSLOT_HAS_POSIX_THREADS
+
+}; // namespace sigslot
diff --git a/webrtc/base/sigslot.h b/webrtc/base/sigslot.h
index df26683..d9b12b0 100644
--- a/webrtc/base/sigslot.h
+++ b/webrtc/base/sigslot.h
@@ -128,21 +128,12 @@
;
}
- virtual ~single_threaded()
- {
- ;
- }
+ virtual ~single_threaded() {}
- virtual void lock()
- {
- ;
- }
+ virtual void lock() {}
- virtual void unlock()
- {
- ;
- }
- };
+ virtual void unlock() {}
+ };
#ifdef _SIGSLOT_HAS_WIN32_THREADS
// The multi threading policies only get compiled in if they are enabled.
@@ -226,32 +217,13 @@
class multi_threaded_global
{
public:
- multi_threaded_global()
- {
- pthread_mutex_init(get_mutex(), NULL);
- }
+ multi_threaded_global();
+ multi_threaded_global(const multi_threaded_global&);
+ virtual ~multi_threaded_global();
+ virtual void lock();
+ virtual void unlock();
- multi_threaded_global(const multi_threaded_global&)
- {
- ;
- }
-
- virtual ~multi_threaded_global()
- {
- ;
- }
-
- virtual void lock()
- {
- pthread_mutex_lock(get_mutex());
- }
-
- virtual void unlock()
- {
- pthread_mutex_unlock(get_mutex());
- }
-
- private:
+ private:
pthread_mutex_t* get_mutex()
{
static pthread_mutex_t g_mutex;
@@ -262,32 +234,13 @@
class multi_threaded_local
{
public:
- multi_threaded_local()
- {
- pthread_mutex_init(&m_mutex, NULL);
- }
+ multi_threaded_local();
+ multi_threaded_local(const multi_threaded_local&);
+ virtual ~multi_threaded_local();
+ virtual void lock();
+ virtual void unlock();
- multi_threaded_local(const multi_threaded_local&)
- {
- pthread_mutex_init(&m_mutex, NULL);
- }
-
- virtual ~multi_threaded_local()
- {
- pthread_mutex_destroy(&m_mutex);
- }
-
- virtual void lock()
- {
- pthread_mutex_lock(&m_mutex);
- }
-
- virtual void unlock()
- {
- pthread_mutex_unlock(&m_mutex);
- }
-
- private:
+ private:
pthread_mutex_t m_mutex;
};
#endif // _SIGSLOT_HAS_POSIX_THREADS
diff --git a/webrtc/base/socketadapters.cc b/webrtc/base/socketadapters.cc
index 58d40f5..4a2da0a 100644
--- a/webrtc/base/socketadapters.cc
+++ b/webrtc/base/socketadapters.cc
@@ -117,6 +117,13 @@
ProcessInput(buffer_, &data_len_);
}
+AsyncProxyServerSocket::AsyncProxyServerSocket(AsyncSocket* socket,
+ size_t buffer_size)
+ : BufferedReadAdapter(socket, buffer_size) {
+}
+
+AsyncProxyServerSocket::~AsyncProxyServerSocket() = default;
+
///////////////////////////////////////////////////////////////////////////////
// This is a SSL v2 CLIENT_HELLO message.
@@ -507,6 +514,8 @@
user_(username), pass_(password) {
}
+AsyncSocksProxySocket::~AsyncSocksProxySocket() = default;
+
int AsyncSocksProxySocket::Connect(const SocketAddress& addr) {
int ret;
dest_ = addr;
diff --git a/webrtc/base/socketadapters.h b/webrtc/base/socketadapters.h
index ddf4f18..a93d26f 100644
--- a/webrtc/base/socketadapters.h
+++ b/webrtc/base/socketadapters.h
@@ -31,10 +31,10 @@
class BufferedReadAdapter : public AsyncSocketAdapter {
public:
BufferedReadAdapter(AsyncSocket* socket, size_t buffer_size);
- virtual ~BufferedReadAdapter();
+ ~BufferedReadAdapter() override;
- virtual int Send(const void* pv, size_t cb);
- virtual int Recv(void* pv, size_t cb);
+ int Send(const void* pv, size_t cb) override;
+ int Recv(void* pv, size_t cb) override;
protected:
int DirectSend(const void* pv, size_t cb) {
@@ -44,7 +44,7 @@
void BufferInput(bool on = true);
virtual void ProcessInput(char* data, size_t* len) = 0;
- virtual void OnReadEvent(AsyncSocket * socket);
+ void OnReadEvent(AsyncSocket* socket) override;
private:
char * buffer_;
@@ -58,8 +58,8 @@
// Interface for implementing proxy server sockets.
class AsyncProxyServerSocket : public BufferedReadAdapter {
public:
- AsyncProxyServerSocket(AsyncSocket* socket, size_t buffer_size)
- : BufferedReadAdapter(socket, buffer_size) {}
+ AsyncProxyServerSocket(AsyncSocket* socket, size_t buffer_size);
+ ~AsyncProxyServerSocket() override;
sigslot::signal2<AsyncProxyServerSocket*,
const SocketAddress&> SignalConnectRequest;
virtual void SendConnectResult(int err, const SocketAddress& addr) = 0;
@@ -73,11 +73,11 @@
public:
explicit AsyncSSLSocket(AsyncSocket* socket);
- virtual int Connect(const SocketAddress& addr);
+ int Connect(const SocketAddress& addr) override;
protected:
- virtual void OnConnectEvent(AsyncSocket* socket);
- virtual void ProcessInput(char* data, size_t* len);
+ void OnConnectEvent(AsyncSocket* socket) override;
+ void ProcessInput(char* data, size_t* len) override;
DISALLOW_EVIL_CONSTRUCTORS(AsyncSSLSocket);
};
@@ -88,7 +88,7 @@
explicit AsyncSSLServerSocket(AsyncSocket* socket);
protected:
- virtual void ProcessInput(char* data, size_t* len);
+ void ProcessInput(char* data, size_t* len) override;
DISALLOW_EVIL_CONSTRUCTORS(AsyncSSLServerSocket);
};
@@ -100,22 +100,22 @@
AsyncHttpsProxySocket(AsyncSocket* socket, const std::string& user_agent,
const SocketAddress& proxy,
const std::string& username, const CryptString& password);
- virtual ~AsyncHttpsProxySocket();
+ ~AsyncHttpsProxySocket() override;
// If connect is forced, the adapter will always issue an HTTP CONNECT to the
// target address. Otherwise, it will connect only if the destination port
// is not port 80.
void SetForceConnect(bool force) { force_connect_ = force; }
- virtual int Connect(const SocketAddress& addr);
- virtual SocketAddress GetRemoteAddress() const;
- virtual int Close();
- virtual ConnState GetState() const;
+ int Connect(const SocketAddress& addr) override;
+ SocketAddress GetRemoteAddress() const override;
+ int Close() override;
+ ConnState GetState() const override;
protected:
- virtual void OnConnectEvent(AsyncSocket* socket);
- virtual void OnCloseEvent(AsyncSocket* socket, int err);
- virtual void ProcessInput(char* data, size_t* len);
+ void OnConnectEvent(AsyncSocket* socket) override;
+ void OnCloseEvent(AsyncSocket* socket, int err) override;
+ void ProcessInput(char* data, size_t* len) override;
bool ShouldIssueConnect() const;
void SendRequest();
@@ -159,15 +159,16 @@
public:
AsyncSocksProxySocket(AsyncSocket* socket, const SocketAddress& proxy,
const std::string& username, const CryptString& password);
+ ~AsyncSocksProxySocket() override;
- virtual int Connect(const SocketAddress& addr);
- virtual SocketAddress GetRemoteAddress() const;
- virtual int Close();
- virtual ConnState GetState() const;
+ int Connect(const SocketAddress& addr) override;
+ SocketAddress GetRemoteAddress() const override;
+ int Close() override;
+ ConnState GetState() const override;
protected:
- virtual void OnConnectEvent(AsyncSocket* socket);
- virtual void ProcessInput(char* data, size_t* len);
+ void OnConnectEvent(AsyncSocket* socket) override;
+ void ProcessInput(char* data, size_t* len) override;
void SendHello();
void SendConnect();
@@ -191,7 +192,7 @@
explicit AsyncSocksProxyServerSocket(AsyncSocket* socket);
private:
- virtual void ProcessInput(char* data, size_t* len);
+ void ProcessInput(char* data, size_t* len) override;
void DirectSend(const ByteBuffer& buf);
void HandleHello(ByteBuffer* request);
@@ -199,7 +200,7 @@
void HandleAuth(ByteBuffer* request);
void SendAuthReply(uint8 result);
void HandleConnect(ByteBuffer* request);
- virtual void SendConnectResult(int result, const SocketAddress& addr);
+ void SendConnectResult(int result, const SocketAddress& addr) override;
void Error(int error);
@@ -219,15 +220,15 @@
LoggingSocketAdapter(AsyncSocket* socket, LoggingSeverity level,
const char * label, bool hex_mode = false);
- virtual int Send(const void *pv, size_t cb);
- virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr);
- virtual int Recv(void *pv, size_t cb);
- virtual int RecvFrom(void *pv, size_t cb, SocketAddress *paddr);
- virtual int Close();
+ int Send(const void* pv, size_t cb) override;
+ int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
+ int Recv(void* pv, size_t cb) override;
+ int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override;
+ int Close() override;
protected:
- virtual void OnConnectEvent(AsyncSocket * socket);
- virtual void OnCloseEvent(AsyncSocket * socket, int err);
+ void OnConnectEvent(AsyncSocket* socket) override;
+ void OnCloseEvent(AsyncSocket* socket, int err) override;
private:
LoggingSeverity level_;
diff --git a/webrtc/base/socketpool.h b/webrtc/base/socketpool.h
index 7bcaa06..5ceab20 100644
--- a/webrtc/base/socketpool.h
+++ b/webrtc/base/socketpool.h
@@ -46,12 +46,12 @@
class StreamCache : public StreamPool, public sigslot::has_slots<> {
public:
StreamCache(StreamPool* pool);
- virtual ~StreamCache();
+ ~StreamCache() override;
// StreamPool Interface
- virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote,
- int* err);
- virtual void ReturnConnectedStream(StreamInterface* stream);
+ StreamInterface* RequestConnectedStream(const SocketAddress& remote,
+ int* err) override;
+ void ReturnConnectedStream(StreamInterface* stream) override;
private:
typedef std::pair<SocketAddress, StreamInterface*> ConnectedStream;
@@ -75,13 +75,13 @@
class NewSocketPool : public StreamPool {
public:
NewSocketPool(SocketFactory* factory);
- virtual ~NewSocketPool();
+ ~NewSocketPool() override;
// StreamPool Interface
- virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote,
- int* err);
- virtual void ReturnConnectedStream(StreamInterface* stream);
-
+ StreamInterface* RequestConnectedStream(const SocketAddress& remote,
+ int* err) override;
+ void ReturnConnectedStream(StreamInterface* stream) override;
+
private:
SocketFactory* factory_;
};
@@ -95,13 +95,13 @@
class ReuseSocketPool : public StreamPool, public sigslot::has_slots<> {
public:
ReuseSocketPool(SocketFactory* factory);
- virtual ~ReuseSocketPool();
+ ~ReuseSocketPool() override;
// StreamPool Interface
- virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote,
- int* err);
- virtual void ReturnConnectedStream(StreamInterface* stream);
-
+ StreamInterface* RequestConnectedStream(const SocketAddress& remote,
+ int* err) override;
+ void ReturnConnectedStream(StreamInterface* stream) override;
+
private:
void OnStreamEvent(StreamInterface* stream, int events, int err);
@@ -120,12 +120,12 @@
public:
LoggingPoolAdapter(StreamPool* pool, LoggingSeverity level,
const std::string& label, bool binary_mode);
- virtual ~LoggingPoolAdapter();
+ ~LoggingPoolAdapter() override;
// StreamPool Interface
- virtual StreamInterface* RequestConnectedStream(const SocketAddress& remote,
- int* err);
- virtual void ReturnConnectedStream(StreamInterface* stream);
+ StreamInterface* RequestConnectedStream(const SocketAddress& remote,
+ int* err) override;
+ void ReturnConnectedStream(StreamInterface* stream) override;
private:
StreamPool* pool_;
diff --git a/webrtc/base/socketstream.h b/webrtc/base/socketstream.h
index ce9939b..4e65cb2 100644
--- a/webrtc/base/socketstream.h
+++ b/webrtc/base/socketstream.h
@@ -22,22 +22,26 @@
class SocketStream : public StreamInterface, public sigslot::has_slots<> {
public:
explicit SocketStream(AsyncSocket* socket);
- virtual ~SocketStream();
+ ~SocketStream() override;
void Attach(AsyncSocket* socket);
AsyncSocket* Detach();
AsyncSocket* GetSocket() { return socket_; }
- virtual StreamState GetState() const;
+ StreamState GetState() const override;
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
- virtual void Close();
+ void Close() override;
private:
void OnConnectEvent(AsyncSocket* socket);
diff --git a/webrtc/base/sslidentity.cc b/webrtc/base/sslidentity.cc
index 0008574..ea9f547 100644
--- a/webrtc/base/sslidentity.cc
+++ b/webrtc/base/sslidentity.cc
@@ -88,6 +88,20 @@
return result.str();
}
+SSLCertChain::SSLCertChain(const std::vector<SSLCertificate*>& certs) {
+ ASSERT(!certs.empty());
+ certs_.resize(certs.size());
+ std::transform(certs.begin(), certs.end(), certs_.begin(), DupCert);
+}
+
+SSLCertChain::SSLCertChain(const SSLCertificate* cert) {
+ certs_.push_back(cert->GetReference());
+}
+
+SSLCertChain::~SSLCertChain() {
+ std::for_each(certs_.begin(), certs_.end(), DeleteCert);
+}
+
#if SSL_USE_SCHANNEL
SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
diff --git a/webrtc/base/sslidentity.h b/webrtc/base/sslidentity.h
index a0f32fd..320fe53 100644
--- a/webrtc/base/sslidentity.h
+++ b/webrtc/base/sslidentity.h
@@ -77,18 +77,9 @@
public:
// These constructors copy the provided SSLCertificate(s), so the caller
// retains ownership.
- explicit SSLCertChain(const std::vector<SSLCertificate*>& certs) {
- ASSERT(!certs.empty());
- certs_.resize(certs.size());
- std::transform(certs.begin(), certs.end(), certs_.begin(), DupCert);
- }
- explicit SSLCertChain(const SSLCertificate* cert) {
- certs_.push_back(cert->GetReference());
- }
-
- ~SSLCertChain() {
- std::for_each(certs_.begin(), certs_.end(), DeleteCert);
- }
+ explicit SSLCertChain(const std::vector<SSLCertificate*>& certs);
+ explicit SSLCertChain(const SSLCertificate* cert);
+ ~SSLCertChain();
// Vector access methods.
size_t GetSize() const { return certs_.size(); }
diff --git a/webrtc/base/sslsocketfactory.cc b/webrtc/base/sslsocketfactory.cc
index 84dae0e..d6ec56f 100644
--- a/webrtc/base/sslsocketfactory.cc
+++ b/webrtc/base/sslsocketfactory.cc
@@ -31,11 +31,11 @@
: AsyncSocketAdapter(NULL), factory_(factory), family_(family),
type_(type), detect_(NULL) {
}
- virtual ~ProxySocketAdapter() {
+ ~ProxySocketAdapter() override {
Close();
}
- virtual int Connect(const SocketAddress& addr) {
+ int Connect(const SocketAddress& addr) override {
ASSERT(NULL == detect_);
ASSERT(NULL == socket_);
remote_ = addr;
@@ -51,13 +51,13 @@
detect_->Start();
return SOCKET_ERROR;
}
- virtual int GetError() const {
+ int GetError() const override {
if (socket_) {
return socket_->GetError();
}
return detect_ ? EWOULDBLOCK : EADDRNOTAVAIL;
}
- virtual int Close() {
+ int Close() override {
if (socket_) {
return socket_->Close();
}
@@ -67,7 +67,7 @@
}
return 0;
}
- virtual ConnState GetState() const {
+ ConnState GetState() const override {
if (socket_) {
return socket_->GetState();
}
@@ -99,6 +99,19 @@
// SslSocketFactory
///////////////////////////////////////////////////////////////////////////////
+SslSocketFactory::SslSocketFactory(SocketFactory* factory,
+ const std::string& user_agent)
+ : factory_(factory),
+ agent_(user_agent),
+ autodetect_proxy_(true),
+ force_connect_(false),
+ logging_level_(LS_VERBOSE),
+ binary_mode_(false),
+ ignore_bad_cert_(false) {
+}
+
+SslSocketFactory::~SslSocketFactory() = default;
+
Socket* SslSocketFactory::CreateSocket(int type) {
return CreateSocket(AF_INET, type);
}
diff --git a/webrtc/base/sslsocketfactory.h b/webrtc/base/sslsocketfactory.h
index edb23db..792c15c 100644
--- a/webrtc/base/sslsocketfactory.h
+++ b/webrtc/base/sslsocketfactory.h
@@ -22,11 +22,8 @@
class SslSocketFactory : public SocketFactory {
public:
- SslSocketFactory(SocketFactory* factory, const std::string& user_agent)
- : factory_(factory), agent_(user_agent), autodetect_proxy_(true),
- force_connect_(false), logging_level_(LS_VERBOSE), binary_mode_(false),
- ignore_bad_cert_(false) {
- }
+ SslSocketFactory(SocketFactory* factory, const std::string& user_agent);
+ ~SslSocketFactory() override;
void SetAutoDetectProxy() {
autodetect_proxy_ = true;
@@ -54,11 +51,11 @@
}
// SocketFactory Interface
- virtual Socket* CreateSocket(int type);
- virtual Socket* CreateSocket(int family, int type);
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
private:
friend class ProxySocketAdapter;
diff --git a/webrtc/base/sslstreamadapter.cc b/webrtc/base/sslstreamadapter.cc
index 513ae8c..a592283 100644
--- a/webrtc/base/sslstreamadapter.cc
+++ b/webrtc/base/sslstreamadapter.cc
@@ -45,6 +45,28 @@
#endif
}
+bool SSLStreamAdapter::GetSslCipher(std::string* cipher) {
+ return false;
+}
+
+bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
+ const uint8* context,
+ size_t context_len,
+ bool use_context,
+ uint8* result,
+ size_t result_len) {
+ return false; // Default is unsupported
+}
+
+bool SSLStreamAdapter::SetDtlsSrtpCiphers(
+ const std::vector<std::string>& ciphers) {
+ return false;
+}
+
+bool SSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) {
+ return false;
+}
+
// Note: this matches the logic above with SCHANNEL dominating
#if SSL_USE_SCHANNEL
bool SSLStreamAdapter::HaveDtls() { return false; }
diff --git a/webrtc/base/sslstreamadapter.h b/webrtc/base/sslstreamadapter.h
index c940ecb..2f819c8 100644
--- a/webrtc/base/sslstreamadapter.h
+++ b/webrtc/base/sslstreamadapter.h
@@ -121,9 +121,7 @@
// Retrieves the name of the cipher suite used for the connection
// (e.g. "TLS_RSA_WITH_AES_128_CBC_SHA").
- virtual bool GetSslCipher(std::string* cipher) {
- return false;
- }
+ virtual bool GetSslCipher(std::string* cipher);
// Key Exporter interface from RFC 5705
// Arguments are:
@@ -142,19 +140,11 @@
size_t context_len,
bool use_context,
uint8* result,
- size_t result_len) {
- return false; // Default is unsupported
- }
-
+ size_t result_len);
// DTLS-SRTP interface
- virtual bool SetDtlsSrtpCiphers(const std::vector<std::string>& ciphers) {
- return false;
- }
-
- virtual bool GetDtlsSrtpCipher(std::string* cipher) {
- return false;
- }
+ virtual bool SetDtlsSrtpCiphers(const std::vector<std::string>& ciphers);
+ virtual bool GetDtlsSrtpCipher(std::string* cipher);
// Capabilities testing
static bool HaveDtls();
diff --git a/webrtc/base/sslstreamadapterhelper.cc b/webrtc/base/sslstreamadapterhelper.cc
index d9c6afd..1ab7369 100644
--- a/webrtc/base/sslstreamadapterhelper.cc
+++ b/webrtc/base/sslstreamadapterhelper.cc
@@ -23,6 +23,16 @@
namespace rtc {
+SSLStreamAdapterHelper::SSLStreamAdapterHelper(StreamInterface* stream)
+ : SSLStreamAdapter(stream),
+ state_(SSL_NONE),
+ role_(SSL_CLIENT),
+ ssl_error_code_(0), // Not meaningful yet
+ ssl_mode_(SSL_MODE_TLS) {
+}
+
+SSLStreamAdapterHelper::~SSLStreamAdapterHelper() = default;
+
void SSLStreamAdapterHelper::SetIdentity(SSLIdentity* identity) {
ASSERT(identity_.get() == NULL);
identity_.reset(identity);
diff --git a/webrtc/base/sslstreamadapterhelper.h b/webrtc/base/sslstreamadapterhelper.h
index ef06597..1c856e8 100644
--- a/webrtc/base/sslstreamadapterhelper.h
+++ b/webrtc/base/sslstreamadapterhelper.h
@@ -26,28 +26,23 @@
// (NSS and OpenSSL)
class SSLStreamAdapterHelper : public SSLStreamAdapter {
public:
- explicit SSLStreamAdapterHelper(StreamInterface* stream)
- : SSLStreamAdapter(stream),
- state_(SSL_NONE),
- role_(SSL_CLIENT),
- ssl_error_code_(0), // Not meaningful yet
- ssl_mode_(SSL_MODE_TLS) {}
-
+ explicit SSLStreamAdapterHelper(StreamInterface* stream);
+ ~SSLStreamAdapterHelper() override;
// Overrides of SSLStreamAdapter
- virtual void SetIdentity(SSLIdentity* identity);
- virtual void SetServerRole(SSLRole role = SSL_SERVER);
- virtual void SetMode(SSLMode mode);
+ void SetIdentity(SSLIdentity* identity) override;
+ void SetServerRole(SSLRole role = SSL_SERVER) override;
+ void SetMode(SSLMode mode) override;
- virtual int StartSSLWithServer(const char* server_name);
- virtual int StartSSLWithPeer();
+ int StartSSLWithServer(const char* server_name) override;
+ int StartSSLWithPeer() override;
- virtual bool SetPeerCertificateDigest(const std::string& digest_alg,
- const unsigned char* digest_val,
- size_t digest_len);
- virtual bool GetPeerCertificate(SSLCertificate** cert) const;
- virtual StreamState GetState() const;
- virtual void Close();
+ bool SetPeerCertificateDigest(const std::string& digest_alg,
+ const unsigned char* digest_val,
+ size_t digest_len) override;
+ bool GetPeerCertificate(SSLCertificate** cert) const override;
+ StreamState GetState() const override;
+ void Close() override;
protected:
// Internal helper methods
diff --git a/webrtc/base/stream.cc b/webrtc/base/stream.cc
index fe99f93..4a85c9f 100644
--- a/webrtc/base/stream.cc
+++ b/webrtc/base/stream.cc
@@ -101,6 +101,42 @@
PostEvent(Thread::Current(), events, err);
}
+const void* StreamInterface::GetReadData(size_t* data_len) {
+ return NULL;
+}
+
+void* StreamInterface::GetWriteBuffer(size_t* buf_len) {
+ return NULL;
+}
+
+bool StreamInterface::SetPosition(size_t position) {
+ return false;
+}
+
+bool StreamInterface::GetPosition(size_t* position) const {
+ return false;
+}
+
+bool StreamInterface::GetSize(size_t* size) const {
+ return false;
+}
+
+bool StreamInterface::GetAvailable(size_t* size) const {
+ return false;
+}
+
+bool StreamInterface::GetWriteRemaining(size_t* size) const {
+ return false;
+}
+
+bool StreamInterface::Flush() {
+ return false;
+}
+
+bool StreamInterface::ReserveSize(size_t size) {
+ return true;
+}
+
StreamInterface::StreamInterface() {
}
@@ -123,6 +159,53 @@
stream_->SignalEvent.connect(this, &StreamAdapterInterface::OnEvent);
}
+StreamState StreamAdapterInterface::GetState() const {
+ return stream_->GetState();
+}
+StreamResult StreamAdapterInterface::Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) {
+ return stream_->Read(buffer, buffer_len, read, error);
+}
+StreamResult StreamAdapterInterface::Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) {
+ return stream_->Write(data, data_len, written, error);
+}
+void StreamAdapterInterface::Close() {
+ stream_->Close();
+}
+
+bool StreamAdapterInterface::SetPosition(size_t position) {
+ return stream_->SetPosition(position);
+}
+
+bool StreamAdapterInterface::GetPosition(size_t* position) const {
+ return stream_->GetPosition(position);
+}
+
+bool StreamAdapterInterface::GetSize(size_t* size) const {
+ return stream_->GetSize(size);
+}
+
+bool StreamAdapterInterface::GetAvailable(size_t* size) const {
+ return stream_->GetAvailable(size);
+}
+
+bool StreamAdapterInterface::GetWriteRemaining(size_t* size) const {
+ return stream_->GetWriteRemaining(size);
+}
+
+bool StreamAdapterInterface::ReserveSize(size_t size) {
+ return stream_->ReserveSize(size);
+}
+
+bool StreamAdapterInterface::Flush() {
+ return stream_->Flush();
+}
+
void StreamAdapterInterface::Attach(StreamInterface* stream, bool owned) {
if (NULL != stream_)
stream_->SignalEvent.disconnect(this);
@@ -147,6 +230,12 @@
delete stream_;
}
+void StreamAdapterInterface::OnEvent(StreamInterface* stream,
+ int events,
+ int err) {
+ SignalEvent(this, events, err);
+}
+
///////////////////////////////////////////////////////////////////////////////
// StreamTap
///////////////////////////////////////////////////////////////////////////////
@@ -157,6 +246,8 @@
AttachTap(tap);
}
+StreamTap::~StreamTap() = default;
+
void StreamTap::AttachTap(StreamInterface* tap) {
tap_.reset(tap);
}
@@ -609,6 +700,13 @@
return result;
}
+AsyncWriteStream::AsyncWriteStream(StreamInterface* stream,
+ rtc::Thread* write_thread)
+ : stream_(stream),
+ write_thread_(write_thread),
+ state_(stream ? stream->GetState() : SS_CLOSED) {
+}
+
AsyncWriteStream::~AsyncWriteStream() {
write_thread_->Clear(this, 0, NULL);
ClearBufferAndWrite();
@@ -617,6 +715,10 @@
stream_.reset();
}
+StreamState AsyncWriteStream::GetState() const {
+ return state_;
+}
+
// This is needed by some stream writers, such as RtpDumpWriter.
bool AsyncWriteStream::GetPosition(size_t* position) const {
CritScope cs(&crit_stream_);
diff --git a/webrtc/base/stream.h b/webrtc/base/stream.h
index 00ded37..2a29b23 100644
--- a/webrtc/base/stream.h
+++ b/webrtc/base/stream.h
@@ -63,7 +63,7 @@
MSG_POST_EVENT = 0xF1F1, MSG_MAX = MSG_POST_EVENT
};
- virtual ~StreamInterface();
+ ~StreamInterface() override;
virtual StreamState GetState() const = 0;
@@ -130,7 +130,7 @@
// does not require a matching call to ConsumeReadData if the data is not
// processed. Read and ConsumeReadData invalidate the buffer returned by
// GetReadData.
- virtual const void* GetReadData(size_t* data_len) { return NULL; }
+ virtual const void* GetReadData(size_t* data_len);
virtual void ConsumeReadData(size_t used) {}
// GetWriteBuffer returns a pointer to a buffer which is owned by the stream.
@@ -144,7 +144,7 @@
// amount of buffer is not yet available, return NULL and Signal SE_WRITE
// when it is available. If the requested amount is too large, return an
// error.
- virtual void* GetWriteBuffer(size_t* buf_len) { return NULL; }
+ virtual void* GetWriteBuffer(size_t* buf_len);
virtual void ConsumeWriteBuffer(size_t used) {}
// Write data_len bytes found in data, circumventing any throttling which
@@ -165,33 +165,33 @@
// Seek to a byte offset from the beginning of the stream. Returns false if
// the stream does not support seeking, or cannot seek to the specified
// position.
- virtual bool SetPosition(size_t position) { return false; }
+ virtual bool SetPosition(size_t position);
// Get the byte offset of the current position from the start of the stream.
// Returns false if the position is not known.
- virtual bool GetPosition(size_t* position) const { return false; }
+ virtual bool GetPosition(size_t* position) const;
// Get the byte length of the entire stream. Returns false if the length
// is not known.
- virtual bool GetSize(size_t* size) const { return false; }
+ virtual bool GetSize(size_t* size) const;
// Return the number of Read()-able bytes remaining before end-of-stream.
// Returns false if not known.
- virtual bool GetAvailable(size_t* size) const { return false; }
+ virtual bool GetAvailable(size_t* size) const;
// Return the number of Write()-able bytes remaining before end-of-stream.
// Returns false if not known.
- virtual bool GetWriteRemaining(size_t* size) const { return false; }
+ virtual bool GetWriteRemaining(size_t* size) const;
// Return true if flush is successful.
- virtual bool Flush() { return false; }
+ virtual bool Flush();
// Communicates the amount of data which will be written to the stream. The
// stream may choose to preallocate memory to accomodate this data. The
// stream may return false to indicate that there is not enough room (ie,
// Write will return SR_EOS/SR_ERROR at some point). Note that calling this
// function should not affect the existing state of data in the stream.
- virtual bool ReserveSize(size_t size) { return true; }
+ virtual bool ReserveSize(size_t size);
//
// CONVENIENCE METHODS
@@ -225,7 +225,7 @@
StreamInterface();
// MessageHandler Interface
- virtual void OnMessage(Message* msg);
+ void OnMessage(Message* msg) override;
private:
DISALLOW_EVIL_CONSTRUCTORS(StreamInterface);
@@ -245,20 +245,16 @@
explicit StreamAdapterInterface(StreamInterface* stream, bool owned = true);
// Core Stream Interface
- virtual StreamState GetState() const {
- return stream_->GetState();
- }
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error) {
- return stream_->Read(buffer, buffer_len, read, error);
- }
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error) {
- return stream_->Write(data, data_len, written, error);
- }
- virtual void Close() {
- stream_->Close();
- }
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
// Optional Stream Interface
/* Note: Many stream adapters were implemented prior to this Read/Write
@@ -287,39 +283,23 @@
}
*/
- virtual bool SetPosition(size_t position) {
- return stream_->SetPosition(position);
- }
- virtual bool GetPosition(size_t* position) const {
- return stream_->GetPosition(position);
- }
- virtual bool GetSize(size_t* size) const {
- return stream_->GetSize(size);
- }
- virtual bool GetAvailable(size_t* size) const {
- return stream_->GetAvailable(size);
- }
- virtual bool GetWriteRemaining(size_t* size) const {
- return stream_->GetWriteRemaining(size);
- }
- virtual bool ReserveSize(size_t size) {
- return stream_->ReserveSize(size);
- }
- virtual bool Flush() {
- return stream_->Flush();
- }
+ bool SetPosition(size_t position) override;
+ bool GetPosition(size_t* position) const override;
+ bool GetSize(size_t* size) const override;
+ bool GetAvailable(size_t* size) const override;
+ bool GetWriteRemaining(size_t* size) const override;
+ bool ReserveSize(size_t size) override;
+ bool Flush() override;
void Attach(StreamInterface* stream, bool owned = true);
StreamInterface* Detach();
protected:
- virtual ~StreamAdapterInterface();
+ ~StreamAdapterInterface() override;
// Note that the adapter presents itself as the origin of the stream events,
// since users of the adapter may not recognize the adapted object.
- virtual void OnEvent(StreamInterface* stream, int events, int err) {
- SignalEvent(this, events, err);
- }
+ virtual void OnEvent(StreamInterface* stream, int events, int err);
StreamInterface* stream() { return stream_; }
private:
@@ -337,16 +317,21 @@
class StreamTap : public StreamAdapterInterface {
public:
explicit StreamTap(StreamInterface* stream, StreamInterface* tap);
+ ~StreamTap() override;
void AttachTap(StreamInterface* tap);
StreamInterface* DetachTap();
StreamResult GetTapResult(int* error);
// StreamAdapterInterface Interface
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
private:
scoped_ptr<StreamInterface> tap_;
@@ -371,12 +356,14 @@
explicit StreamSegment(StreamInterface* stream, size_t length);
// StreamAdapterInterface Interface
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual bool SetPosition(size_t position);
- virtual bool GetPosition(size_t* position) const;
- virtual bool GetSize(size_t* size) const;
- virtual bool GetAvailable(size_t* size) const;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ bool SetPosition(size_t position) override;
+ bool GetPosition(size_t* position) const override;
+ bool GetSize(size_t* size) const override;
+ bool GetAvailable(size_t* size) const override;
private:
size_t start_, pos_, length_;
@@ -390,15 +377,19 @@
class NullStream : public StreamInterface {
public:
NullStream();
- virtual ~NullStream();
+ ~NullStream() override;
// StreamInterface Interface
- virtual StreamState GetState() const;
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
};
///////////////////////////////////////////////////////////////////////////////
@@ -409,7 +400,7 @@
class FileStream : public StreamInterface {
public:
FileStream();
- virtual ~FileStream();
+ ~FileStream() override;
// The semantics of filename and mode are the same as stdio's fopen
virtual bool Open(const std::string& filename, const char* mode, int* error);
@@ -420,19 +411,23 @@
// buffering causes writes to block until the bytes on disk are updated.
virtual bool DisableBuffering();
- virtual StreamState GetState() const;
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
- virtual bool SetPosition(size_t position);
- virtual bool GetPosition(size_t* position) const;
- virtual bool GetSize(size_t* size) const;
- virtual bool GetAvailable(size_t* size) const;
- virtual bool ReserveSize(size_t size);
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
+ bool SetPosition(size_t position) override;
+ bool GetPosition(size_t* position) const override;
+ bool GetSize(size_t* size) const override;
+ bool GetAvailable(size_t* size) const override;
+ bool ReserveSize(size_t size) override;
- virtual bool Flush();
+ bool Flush() override;
#if defined(WEBRTC_POSIX) && !defined(__native_client__)
// Tries to aquire an exclusive lock on the file.
@@ -460,11 +455,15 @@
public:
explicit CircularFileStream(size_t max_size);
- virtual bool Open(const std::string& filename, const char* mode, int* error);
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
+ bool Open(const std::string& filename, const char* mode, int* error) override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
private:
enum ReadSegment {
@@ -487,28 +486,27 @@
class AsyncWriteStream : public StreamInterface {
public:
// Takes ownership of the stream, but not the thread.
- AsyncWriteStream(StreamInterface* stream, rtc::Thread* write_thread)
- : stream_(stream),
- write_thread_(write_thread),
- state_(stream ? stream->GetState() : SS_CLOSED) {
- }
-
- virtual ~AsyncWriteStream();
+ AsyncWriteStream(StreamInterface* stream, rtc::Thread* write_thread);
+ ~AsyncWriteStream() override;
// StreamInterface Interface
- virtual StreamState GetState() const { return state_; }
+ StreamState GetState() const override;
// This is needed by some stream writers, such as RtpDumpWriter.
- virtual bool GetPosition(size_t* position) const;
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
- virtual bool Flush();
+ bool GetPosition(size_t* position) const override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
+ bool Flush() override;
protected:
// From MessageHandler
- virtual void OnMessage(rtc::Message* pmsg);
+ void OnMessage(rtc::Message* pmsg) override;
virtual void ClearBufferAndWrite();
private:
@@ -530,13 +528,16 @@
class POpenStream : public FileStream {
public:
POpenStream() : wait_status_(-1) {}
- virtual ~POpenStream();
+ ~POpenStream() override;
- virtual bool Open(const std::string& subcommand, const char* mode,
- int* error);
+ bool Open(const std::string& subcommand,
+ const char* mode,
+ int* error) override;
// Same as Open(). shflag is ignored.
- virtual bool OpenShare(const std::string& subcommand, const char* mode,
- int shflag, int* error);
+ bool OpenShare(const std::string& subcommand,
+ const char* mode,
+ int shflag,
+ int* error) override;
// Returns the wait status from the last Close() of an Open()'ed stream, or
// -1 if no Open()+Close() has been done on this object. Meaning of the number
@@ -544,7 +545,7 @@
int GetWaitStatus() const { return wait_status_; }
protected:
- virtual void DoClose();
+ void DoClose() override;
private:
int wait_status_;
@@ -560,17 +561,21 @@
class MemoryStreamBase : public StreamInterface {
public:
- virtual StreamState GetState() const;
- virtual StreamResult Read(void* buffer, size_t bytes, size_t* bytes_read,
- int* error);
- virtual StreamResult Write(const void* buffer, size_t bytes,
- size_t* bytes_written, int* error);
- virtual void Close();
- virtual bool SetPosition(size_t position);
- virtual bool GetPosition(size_t* position) const;
- virtual bool GetSize(size_t* size) const;
- virtual bool GetAvailable(size_t* size) const;
- virtual bool ReserveSize(size_t size);
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t bytes,
+ size_t* bytes_read,
+ int* error) override;
+ StreamResult Write(const void* buffer,
+ size_t bytes,
+ size_t* bytes_written,
+ int* error) override;
+ void Close() override;
+ bool SetPosition(size_t position) override;
+ bool GetPosition(size_t* position) const override;
+ bool GetSize(size_t* size) const override;
+ bool GetAvailable(size_t* size) const override;
+ bool ReserveSize(size_t size) override;
char* GetBuffer() { return buffer_; }
const char* GetBuffer() const { return buffer_; }
@@ -597,12 +602,12 @@
MemoryStream();
explicit MemoryStream(const char* data); // Calls SetData(data, strlen(data))
MemoryStream(const void* data, size_t length); // Calls SetData(data, length)
- virtual ~MemoryStream();
+ ~MemoryStream() override;
void SetData(const void* data, size_t length);
protected:
- virtual StreamResult DoReserve(size_t size, int* error);
+ StreamResult DoReserve(size_t size, int* error) override;
// Memory Streams are aligned for efficiency.
static const int kAlignment = 16;
char* buffer_alloc_;
@@ -615,7 +620,7 @@
public:
ExternalMemoryStream();
ExternalMemoryStream(void* data, size_t length);
- virtual ~ExternalMemoryStream();
+ ~ExternalMemoryStream() override;
void SetData(void* data, size_t length);
};
@@ -630,7 +635,7 @@
explicit FifoBuffer(size_t length);
// Creates a FIFO buffer with the specified capacity and owner
FifoBuffer(size_t length, Thread* owner);
- virtual ~FifoBuffer();
+ ~FifoBuffer() override;
// Gets the amount of data currently readable from the buffer.
bool GetBuffered(size_t* data_len) const;
// Resizes the buffer to the specified capacity. Fails if data_length_ > size
@@ -651,17 +656,21 @@
size_t* bytes_written);
// StreamInterface methods
- virtual StreamState GetState() const;
- virtual StreamResult Read(void* buffer, size_t bytes,
- size_t* bytes_read, int* error);
- virtual StreamResult Write(const void* buffer, size_t bytes,
- size_t* bytes_written, int* error);
- virtual void Close();
- virtual const void* GetReadData(size_t* data_len);
- virtual void ConsumeReadData(size_t used);
- virtual void* GetWriteBuffer(size_t* buf_len);
- virtual void ConsumeWriteBuffer(size_t used);
- virtual bool GetWriteRemaining(size_t* size) const;
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t bytes,
+ size_t* bytes_read,
+ int* error) override;
+ StreamResult Write(const void* buffer,
+ size_t bytes,
+ size_t* bytes_written,
+ int* error) override;
+ void Close() override;
+ const void* GetReadData(size_t* data_len) override;
+ void ConsumeReadData(size_t used) override;
+ void* GetWriteBuffer(size_t* buf_len) override;
+ void ConsumeWriteBuffer(size_t used) override;
+ bool GetWriteRemaining(size_t* size) const override;
private:
// Helper method that implements ReadOffset. Caller must acquire a lock
@@ -693,14 +702,18 @@
void set_label(const std::string& label);
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
protected:
- virtual void OnEvent(StreamInterface* stream, int events, int err);
+ void OnEvent(StreamInterface* stream, int events, int err) override;
private:
LoggingSeverity level_;
@@ -720,17 +733,21 @@
explicit StringStream(std::string& str);
explicit StringStream(const std::string& str);
- virtual StreamState GetState() const;
- virtual StreamResult Read(void* buffer, size_t buffer_len,
- size_t* read, int* error);
- virtual StreamResult Write(const void* data, size_t data_len,
- size_t* written, int* error);
- virtual void Close();
- virtual bool SetPosition(size_t position);
- virtual bool GetPosition(size_t* position) const;
- virtual bool GetSize(size_t* size) const;
- virtual bool GetAvailable(size_t* size) const;
- virtual bool ReserveSize(size_t size);
+ StreamState GetState() const override;
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
+ bool SetPosition(size_t position) override;
+ bool GetPosition(size_t* position) const override;
+ bool GetSize(size_t* size) const override;
+ bool GetAvailable(size_t* size) const override;
+ bool ReserveSize(size_t size) override;
private:
std::string& str_;
@@ -760,7 +777,7 @@
explicit StreamReference(StreamInterface* stream);
StreamInterface* GetStream() { return stream(); }
StreamInterface* NewReference();
- virtual ~StreamReference();
+ ~StreamReference() override;
private:
class StreamRefCount {
diff --git a/webrtc/base/systeminfo.cc b/webrtc/base/systeminfo.cc
index c8d2c78..6d8d5ba 100644
--- a/webrtc/base/systeminfo.cc
+++ b/webrtc/base/systeminfo.cc
@@ -461,6 +461,11 @@
}
#endif
+SystemInfo::GpuInfo::GpuInfo() : vendor_id(0), device_id(0) {
+}
+
+SystemInfo::GpuInfo::~GpuInfo() = default;
+
// Fills a struct with information on the graphics adapater and returns true
// iff successful.
bool SystemInfo::GetGpuInfo(GpuInfo *info) {
diff --git a/webrtc/base/systeminfo.h b/webrtc/base/systeminfo.h
index 4408862..47b93f6 100644
--- a/webrtc/base/systeminfo.h
+++ b/webrtc/base/systeminfo.h
@@ -52,7 +52,8 @@
// The gpu identifier
struct GpuInfo {
- GpuInfo() : vendor_id(0), device_id(0) {}
+ GpuInfo();
+ ~GpuInfo();
std::string device_name;
std::string description;
int vendor_id;
diff --git a/webrtc/base/task.cc b/webrtc/base/task.cc
index ed9f426..d81a6d2 100644
--- a/webrtc/base/task.cc
+++ b/webrtc/base/task.cc
@@ -224,6 +224,10 @@
TaskParent::OnStopped(this);
}
+int Task::ProcessResponse() {
+ return STATE_DONE;
+}
+
void Task::set_timeout_seconds(const int timeout_seconds) {
timeout_seconds_ = timeout_seconds;
ResetTimeout();
@@ -269,4 +273,9 @@
}
}
+int Task::OnTimeout() {
+ // by default, we are finished after timing out
+ return STATE_DONE;
+}
+
} // namespace rtc
diff --git a/webrtc/base/task.h b/webrtc/base/task.h
index 77d767a..3e43e11 100644
--- a/webrtc/base/task.h
+++ b/webrtc/base/task.h
@@ -93,7 +93,7 @@
class Task : public TaskParent {
public:
Task(TaskParent *parent);
- virtual ~Task();
+ ~Task() override;
int32 unique_id() { return unique_id_; }
@@ -140,7 +140,7 @@
virtual int Process(int state);
virtual void Stop();
virtual int ProcessStart() = 0;
- virtual int ProcessResponse() { return STATE_DONE; }
+ virtual int ProcessResponse();
void ResetTimeout();
void ClearTimeout();
@@ -149,10 +149,7 @@
void ResumeTimeout();
protected:
- virtual int OnTimeout() {
- // by default, we are finished after timing out
- return STATE_DONE;
- }
+ virtual int OnTimeout();
private:
void Done();
diff --git a/webrtc/base/taskparent.cc b/webrtc/base/taskparent.cc
index 97cbc9d..db6db37 100644
--- a/webrtc/base/taskparent.cc
+++ b/webrtc/base/taskparent.cc
@@ -34,6 +34,8 @@
Initialize();
}
+TaskParent::~TaskParent() = default;
+
// Does common initialization of member variables
void TaskParent::Initialize() {
children_.reset(new ChildSet());
diff --git a/webrtc/base/taskparent.h b/webrtc/base/taskparent.h
index a383202..f26d797 100644
--- a/webrtc/base/taskparent.h
+++ b/webrtc/base/taskparent.h
@@ -25,7 +25,7 @@
public:
TaskParent(Task *derived_instance, TaskParent *parent);
explicit TaskParent(TaskRunner *derived_instance);
- virtual ~TaskParent() { }
+ virtual ~TaskParent();
TaskParent *GetParent() { return parent_; }
TaskRunner *GetRunner() { return runner_; }
diff --git a/webrtc/base/taskrunner.h b/webrtc/base/taskrunner.h
index 629c2d3..bdcebc4 100644
--- a/webrtc/base/taskrunner.h
+++ b/webrtc/base/taskrunner.h
@@ -27,7 +27,7 @@
class TaskRunner : public TaskParent, public sigslot::has_slots<> {
public:
TaskRunner();
- virtual ~TaskRunner();
+ ~TaskRunner() override;
virtual void WakeTasks() = 0;
diff --git a/webrtc/base/testclient.h b/webrtc/base/testclient.h
index 52058e3..8e692b6 100644
--- a/webrtc/base/testclient.h
+++ b/webrtc/base/testclient.h
@@ -38,7 +38,7 @@
// Creates a client that will send and receive with the given socket and
// will post itself messages with the given thread.
explicit TestClient(AsyncPacketSocket* socket);
- ~TestClient();
+ ~TestClient() override;
SocketAddress address() const { return socket_->GetLocalAddress(); }
SocketAddress remote_address() const { return socket_->GetRemoteAddress(); }
diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h
index 2650547..d9dbb0b 100644
--- a/webrtc/base/thread.h
+++ b/webrtc/base/thread.h
@@ -106,7 +106,7 @@
// guarantee Stop() is explicitly called before the subclass is destroyed).
// This is required to avoid a data race between the destructor modifying the
// vtable, and the Thread::PreRun calling the virtual method Run().
- virtual ~Thread();
+ ~Thread() override;
static Thread* Current();
@@ -173,9 +173,10 @@
}
// From MessageQueue
- virtual void Clear(MessageHandler *phandler, uint32 id = MQID_ANY,
- MessageList* removed = NULL);
- virtual void ReceiveSends();
+ void Clear(MessageHandler* phandler,
+ uint32 id = MQID_ANY,
+ MessageList* removed = NULL) override;
+ void ReceiveSends() override;
// ProcessMessages will process I/O and dispatch messages until:
// 1) cms milliseconds have elapsed (returns true)
@@ -290,7 +291,7 @@
class AutoThread : public Thread {
public:
explicit AutoThread(SocketServer* ss = 0);
- virtual ~AutoThread();
+ ~AutoThread() override;
private:
DISALLOW_COPY_AND_ASSIGN(AutoThread);
diff --git a/webrtc/base/transformadapter.cc b/webrtc/base/transformadapter.cc
index 76b750c..d6d85b5 100644
--- a/webrtc/base/transformadapter.cc
+++ b/webrtc/base/transformadapter.cc
@@ -182,4 +182,16 @@
StreamAdapterInterface::Close();
}
+bool TransformAdapter::GetAvailable(size_t* size) const {
+ return false;
+}
+
+bool TransformAdapter::ReserveSize(size_t size) {
+ return true;
+}
+
+bool TransformAdapter::Rewind() {
+ return false;
+}
+
} // namespace rtc
diff --git a/webrtc/base/transformadapter.h b/webrtc/base/transformadapter.h
index ad24438..290d560 100644
--- a/webrtc/base/transformadapter.h
+++ b/webrtc/base/transformadapter.h
@@ -45,20 +45,24 @@
TransformAdapter(StreamInterface * stream,
TransformInterface * transform,
bool direction_read);
- virtual ~TransformAdapter();
-
- virtual StreamResult Read(void * buffer, size_t buffer_len,
- size_t * read, int * error);
- virtual StreamResult Write(const void * data, size_t data_len,
- size_t * written, int * error);
- virtual void Close();
+ ~TransformAdapter() override;
+
+ StreamResult Read(void* buffer,
+ size_t buffer_len,
+ size_t* read,
+ int* error) override;
+ StreamResult Write(const void* data,
+ size_t data_len,
+ size_t* written,
+ int* error) override;
+ void Close() override;
// Apriori, we can't tell what the transformation does to the stream length.
- virtual bool GetAvailable(size_t* size) const { return false; }
- virtual bool ReserveSize(size_t size) { return true; }
+ bool GetAvailable(size_t* size) const override;
+ bool ReserveSize(size_t size) override;
// Transformations might not be restartable
- virtual bool Rewind() { return false; }
+ virtual bool Rewind();
private:
enum State { ST_PROCESSING, ST_FLUSHING, ST_COMPLETE, ST_ERROR };
diff --git a/webrtc/base/unixfilesystem.h b/webrtc/base/unixfilesystem.h
index 7b6c20e..e220911 100644
--- a/webrtc/base/unixfilesystem.h
+++ b/webrtc/base/unixfilesystem.h
@@ -20,7 +20,7 @@
class UnixFilesystem : public FilesystemInterface {
public:
UnixFilesystem();
- virtual ~UnixFilesystem();
+ ~UnixFilesystem() override;
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
// Android does not have a native code API to fetch the app data or temp
@@ -36,21 +36,21 @@
// Opens a file. Returns an open StreamInterface if function succeeds.
// Otherwise, returns NULL.
- virtual FileStream *OpenFile(const Pathname &filename,
- const std::string &mode);
+ FileStream* OpenFile(const Pathname& filename,
+ const std::string& mode) override;
// Atomically creates an empty file accessible only to the current user if one
// does not already exist at the given path, otherwise fails.
- virtual bool CreatePrivateFile(const Pathname &filename);
+ bool CreatePrivateFile(const Pathname& filename) override;
// This will attempt to delete the file located at filename.
// It will fail with VERIY if you pass it a non-existant file, or a directory.
- virtual bool DeleteFile(const Pathname &filename);
+ bool DeleteFile(const Pathname& filename) override;
// This will attempt to delete the folder located at 'folder'
// It ASSERTs and returns false if you pass it a non-existant folder or a
// plain file.
- virtual bool DeleteEmptyFolder(const Pathname &folder);
+ bool DeleteEmptyFolder(const Pathname& folder) override;
// Creates a directory. This will call itself recursively to create /foo/bar
// even if /foo does not exist. All created directories are created with the
@@ -59,56 +59,58 @@
virtual bool CreateFolder(const Pathname &pathname, mode_t mode);
// As above, with mode = 0755.
- virtual bool CreateFolder(const Pathname &pathname);
+ bool CreateFolder(const Pathname& pathname) override;
// This moves a file from old_path to new_path, where "file" can be a plain
// file or directory, which will be moved recursively.
// Returns true if function succeeds.
- virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path);
- virtual bool MoveFolder(const Pathname &old_path, const Pathname &new_path);
+ bool MoveFile(const Pathname& old_path, const Pathname& new_path) override;
+ bool MoveFolder(const Pathname& old_path, const Pathname& new_path) override;
// This copies a file from old_path to _new_path where "file" can be a plain
// file or directory, which will be copied recursively.
// Returns true if function succeeds
- virtual bool CopyFile(const Pathname &old_path, const Pathname &new_path);
+ bool CopyFile(const Pathname& old_path, const Pathname& new_path) override;
// Returns true if a pathname is a directory
- virtual bool IsFolder(const Pathname& pathname);
+ bool IsFolder(const Pathname& pathname) override;
// Returns true if pathname represents a temporary location on the system.
- virtual bool IsTemporaryPath(const Pathname& pathname);
+ bool IsTemporaryPath(const Pathname& pathname) override;
// Returns true of pathname represents an existing file
- virtual bool IsFile(const Pathname& pathname);
+ bool IsFile(const Pathname& pathname) override;
// Returns true if pathname refers to no filesystem object, every parent
// directory either exists, or is also absent.
- virtual bool IsAbsent(const Pathname& pathname);
+ bool IsAbsent(const Pathname& pathname) override;
- virtual std::string TempFilename(const Pathname &dir,
- const std::string &prefix);
+ std::string TempFilename(const Pathname& dir,
+ const std::string& prefix) override;
// A folder appropriate for storing temporary files (Contents are
// automatically deleted when the program exists)
- virtual bool GetTemporaryFolder(Pathname &path, bool create,
- const std::string *append);
+ bool GetTemporaryFolder(Pathname& path,
+ bool create,
+ const std::string* append) override;
- virtual bool GetFileSize(const Pathname& path, size_t* size);
- virtual bool GetFileTime(const Pathname& path, FileTimeType which,
- time_t* time);
+ bool GetFileSize(const Pathname& path, size_t* size) override;
+ bool GetFileTime(const Pathname& path,
+ FileTimeType which,
+ time_t* time) override;
// Returns the path to the running application.
- virtual bool GetAppPathname(Pathname* path);
+ bool GetAppPathname(Pathname* path) override;
- virtual bool GetAppDataFolder(Pathname* path, bool per_user);
+ bool GetAppDataFolder(Pathname* path, bool per_user) override;
// Get a temporary folder that is unique to the current user and application.
- virtual bool GetAppTempFolder(Pathname* path);
+ bool GetAppTempFolder(Pathname* path) override;
- virtual bool GetDiskFreeSpace(const Pathname& path, int64 *freebytes);
+ bool GetDiskFreeSpace(const Pathname& path, int64* freebytes) override;
// Returns the absolute path of the current directory.
- virtual Pathname GetCurrentDirectory();
+ Pathname GetCurrentDirectory() override;
private:
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
diff --git a/webrtc/base/virtualsocketserver.cc b/webrtc/base/virtualsocketserver.cc
index c4fbffd..8cb431d 100644
--- a/webrtc/base/virtualsocketserver.cc
+++ b/webrtc/base/virtualsocketserver.cc
@@ -67,7 +67,7 @@
memcpy(data_, data, size_);
}
- virtual ~Packet() {
+ ~Packet() override {
delete[] data_;
}
diff --git a/webrtc/base/virtualsocketserver.h b/webrtc/base/virtualsocketserver.h
index 96df941..f2c8bd7 100644
--- a/webrtc/base/virtualsocketserver.h
+++ b/webrtc/base/virtualsocketserver.h
@@ -34,7 +34,7 @@
// TODO: Add "owned" parameter.
// If "owned" is set, the supplied socketserver will be deleted later.
explicit VirtualSocketServer(SocketServer* ss);
- virtual ~VirtualSocketServer();
+ ~VirtualSocketServer() override;
SocketServer* socketserver() { return server_; }
@@ -89,16 +89,16 @@
}
// SocketFactory:
- virtual Socket* CreateSocket(int type);
- virtual Socket* CreateSocket(int family, int type);
+ Socket* CreateSocket(int type) override;
+ Socket* CreateSocket(int family, int type) override;
- virtual AsyncSocket* CreateAsyncSocket(int type);
- virtual AsyncSocket* CreateAsyncSocket(int family, int type);
+ AsyncSocket* CreateAsyncSocket(int type) override;
+ AsyncSocket* CreateAsyncSocket(int family, int type) override;
// SocketServer:
- virtual void SetMessageQueue(MessageQueue* queue);
- virtual bool Wait(int cms, bool process_io);
- virtual void WakeUp();
+ void SetMessageQueue(MessageQueue* queue) override;
+ bool Wait(int cms, bool process_io) override;
+ void WakeUp() override;
typedef std::pair<double, double> Point;
typedef std::vector<Point> Function;
@@ -238,10 +238,10 @@
class VirtualSocket : public AsyncSocket, public MessageHandler {
public:
VirtualSocket(VirtualSocketServer* server, int family, int type, bool async);
- virtual ~VirtualSocket();
+ ~VirtualSocket() override;
- virtual SocketAddress GetLocalAddress() const;
- virtual SocketAddress GetRemoteAddress() const;
+ SocketAddress GetLocalAddress() const override;
+ SocketAddress GetRemoteAddress() const override;
// Used by server sockets to set the local address without binding.
void SetLocalAddress(const SocketAddress& addr);
@@ -251,23 +251,23 @@
// issue 3927 for more detail.
void SetAlternativeLocalAddress(const SocketAddress& addr);
- virtual int Bind(const SocketAddress& addr);
- virtual int Connect(const SocketAddress& addr);
- virtual int Close();
- virtual int Send(const void* pv, size_t cb);
- virtual int SendTo(const void* pv, size_t cb, const SocketAddress& addr);
- virtual int Recv(void* pv, size_t cb);
- virtual int RecvFrom(void* pv, size_t cb, SocketAddress* paddr);
- virtual int Listen(int backlog);
- virtual VirtualSocket* Accept(SocketAddress* paddr);
+ int Bind(const SocketAddress& addr) override;
+ int Connect(const SocketAddress& addr) override;
+ int Close() override;
+ int Send(const void* pv, size_t cb) override;
+ int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
+ int Recv(void* pv, size_t cb) override;
+ int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override;
+ int Listen(int backlog) override;
+ VirtualSocket* Accept(SocketAddress* paddr) override;
- virtual int GetError() const;
- virtual void SetError(int error);
- virtual ConnState GetState() const;
- virtual int GetOption(Option opt, int* value);
- virtual int SetOption(Option opt, int value);
- virtual int EstimateMTU(uint16* mtu);
- void OnMessage(Message* pmsg);
+ int GetError() const override;
+ void SetError(int error) override;
+ ConnState GetState() const override;
+ int GetOption(Option opt, int* value) override;
+ int SetOption(Option opt, int value) override;
+ int EstimateMTU(uint16* mtu) override;
+ void OnMessage(Message* pmsg) override;
bool was_any() { return was_any_; }
void set_was_any(bool was_any) { was_any_ = was_any; }
diff --git a/webrtc/base/worker.h b/webrtc/base/worker.h
index 694a780..d5594e3 100644
--- a/webrtc/base/worker.h
+++ b/webrtc/base/worker.h
@@ -34,7 +34,7 @@
Worker();
// Destroys this Worker, but it must have already been stopped via StopWork().
- virtual ~Worker();
+ ~Worker() override;
// Attaches the worker to the current thread and begins processing work if not
// already doing so.
@@ -59,7 +59,7 @@
private:
// Inherited from MessageHandler.
- virtual void OnMessage(Message *msg);
+ void OnMessage(Message* msg) override;
// The thread that is currently doing the work.
Thread *worker_thread_;
diff --git a/webrtc/base/x11windowpicker.h b/webrtc/base/x11windowpicker.h
index 26c7054..b340b88 100644
--- a/webrtc/base/x11windowpicker.h
+++ b/webrtc/base/x11windowpicker.h
@@ -26,17 +26,18 @@
class X11WindowPicker : public WindowPicker {
public:
X11WindowPicker();
- ~X11WindowPicker();
+ ~X11WindowPicker() override;
static bool IsDesktopElement(_XDisplay* display, Window window);
- virtual bool Init();
- virtual bool IsVisible(const WindowId& id);
- virtual bool MoveToFront(const WindowId& id);
- virtual bool GetWindowList(WindowDescriptionList* descriptions);
- virtual bool GetDesktopList(DesktopDescriptionList* descriptions);
- virtual bool GetDesktopDimensions(const DesktopId& id, int* width,
- int* height);
+ bool Init() override;
+ bool IsVisible(const WindowId& id) override;
+ bool MoveToFront(const WindowId& id) override;
+ bool GetWindowList(WindowDescriptionList* descriptions) override;
+ bool GetDesktopList(DesktopDescriptionList* descriptions) override;
+ bool GetDesktopDimensions(const DesktopId& id,
+ int* width,
+ int* height) override;
uint8* GetWindowIcon(const WindowId& id, int* width, int* height);
uint8* GetWindowThumbnail(const WindowId& id, int width, int height);
int GetNumDesktops();