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

Unified Diff: talk/app/webrtc/dtlsidentitystore.cc

Issue 1171893003: Adding DCHECKs and constness to DtlsIdentityStore. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/dtlsidentitystore.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/dtlsidentitystore.cc
diff --git a/talk/app/webrtc/dtlsidentitystore.cc b/talk/app/webrtc/dtlsidentitystore.cc
index dd9bc5d68b501898b1ceada01b7555232953e48e..945429a67125592cf868e88bdb966bf014e3ac57 100644
--- a/talk/app/webrtc/dtlsidentitystore.cc
+++ b/talk/app/webrtc/dtlsidentitystore.cc
@@ -116,6 +116,7 @@ DtlsIdentityStore::~DtlsIdentityStore() {
}
void DtlsIdentityStore::Initialize() {
+ DCHECK(rtc::Thread::Current() == signaling_thread_);
// Do not aggressively generate the free identity if the worker thread and the
// signaling thread are the same.
if (worker_thread_ != signaling_thread_) {
@@ -156,10 +157,12 @@ void DtlsIdentityStore::OnMessage(rtc::Message* msg) {
}
bool DtlsIdentityStore::HasFreeIdentityForTesting() const {
- return free_identity_.get();
+ DCHECK(rtc::Thread::Current() == signaling_thread_);
+ return free_identity_.get() != nullptr;
}
void DtlsIdentityStore::GenerateIdentity() {
hbos 2015/06/09 12:59:11 It's confusing that we have two GenerateIdentity i
tommi 2015/06/09 13:17:17 I added the _w() post fix to the one that runs on
+ DCHECK(rtc::Thread::Current() == signaling_thread_);
pending_jobs_++;
LOG(LS_VERBOSE) << "New DTLS identity generation is posted, "
<< "pending_identities=" << pending_jobs_;
@@ -191,6 +194,7 @@ void DtlsIdentityStore::OnIdentityGenerated(
void DtlsIdentityStore::ReturnIdentity(
rtc::scoped_ptr<rtc::SSLIdentity> identity) {
+ DCHECK(rtc::Thread::Current() == signaling_thread_);
DCHECK(!free_identity_.get());
DCHECK(!pending_observers_.empty());
@@ -211,8 +215,8 @@ void DtlsIdentityStore::ReturnIdentity(
if (worker_thread_ != signaling_thread_ &&
pending_observers_.empty() &&
pending_jobs_ == 0) {
- // Generate a free identity in the background.
- GenerateIdentity();
+ // Generate a free identity in the background.
+ GenerateIdentity();
hbos 2015/06/09 12:59:12 (This generates in case we want to request another
tommi 2015/06/09 13:17:17 yes. I guess that's what the "free identity" refe
}
}
« no previous file with comments | « talk/app/webrtc/dtlsidentitystore.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698