Removed usage of the deprecated critical section constructor in system_wrappers.
Review URL: http://webrtc-codereview.appspot.com/322004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1208 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0a10e3c4b2
commit
bfa80ce95e
@ -47,7 +47,7 @@ static T* GetStaticInstance(CountOperation count_operation) {
|
||||
// reachable from statics leaked so no noise is added by doing this.
|
||||
static CriticalSectionWrapper* crit_sect(
|
||||
CriticalSectionWrapper::CreateCriticalSection());
|
||||
CriticalSectionScoped lock(*crit_sect);
|
||||
CriticalSectionScoped lock(crit_sect);
|
||||
|
||||
if (count_operation ==
|
||||
kAddRefNoCreate && instance_count == 0) {
|
||||
|
@ -158,7 +158,7 @@ bool CpuWindows::StopPollingCpu()
|
||||
// If StopPollingCpu is called immediately after StartPollingCpu() it is
|
||||
// possible that cpu_polling_thread is in the process of initializing.
|
||||
// Let initialization finish to avoid getting into a bad state.
|
||||
CriticalSectionScoped cs(*init_crit_);
|
||||
CriticalSectionScoped cs(init_crit_);
|
||||
while(initialize_)
|
||||
{
|
||||
init_cond_->SleepCS(*init_crit_);
|
||||
@ -169,7 +169,7 @@ bool CpuWindows::StopPollingCpu()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CriticalSectionScoped cs(*terminate_crit_);
|
||||
CriticalSectionScoped cs(terminate_crit_);
|
||||
terminate_ = true;
|
||||
sleep_event->Set();
|
||||
while (!has_terminated_)
|
||||
@ -190,7 +190,7 @@ bool CpuWindows::Process(void* thread_object)
|
||||
bool CpuWindows::ProcessImpl()
|
||||
{
|
||||
{
|
||||
CriticalSectionScoped cs(*terminate_crit_);
|
||||
CriticalSectionScoped cs(terminate_crit_);
|
||||
if (terminate_)
|
||||
{
|
||||
const bool success = Terminate();
|
||||
@ -202,7 +202,7 @@ bool CpuWindows::ProcessImpl()
|
||||
// Initialize on first iteration
|
||||
if (initialize_)
|
||||
{
|
||||
CriticalSectionScoped cs(*init_crit_);
|
||||
CriticalSectionScoped cs(init_crit_);
|
||||
initialize_ = false;
|
||||
const bool success = Initialize();
|
||||
init_cond_->WakeAll();
|
||||
|
@ -120,7 +120,7 @@ Row::~Row() {
|
||||
|
||||
int Row::InsertCell(const std::string& column_name,
|
||||
const Container* value_container) {
|
||||
CriticalSectionScoped synchronize(*cells_lock_);
|
||||
CriticalSectionScoped synchronize(cells_lock_);
|
||||
assert(cells_.count(column_name) == 0);
|
||||
if (cells_.count(column_name) > 0)
|
||||
return -1;
|
||||
@ -130,7 +130,7 @@ int Row::InsertCell(const std::string& column_name,
|
||||
|
||||
void Row::ToString(const std::string& column_name,
|
||||
std::string* value_string) {
|
||||
CriticalSectionScoped synchronize(*cells_lock_);
|
||||
CriticalSectionScoped synchronize(cells_lock_);
|
||||
const Container* container = cells_[column_name];
|
||||
if (container == NULL) {
|
||||
*value_string = "NaN,";
|
||||
@ -179,7 +179,7 @@ int LogTable::AddColumn(const std::string& column_name,
|
||||
assert(false);
|
||||
return -1;
|
||||
} else {
|
||||
CriticalSectionScoped synchronize(*table_lock_);
|
||||
CriticalSectionScoped synchronize(table_lock_);
|
||||
if (write_header_)
|
||||
columns_[column_name] = multi_value_length;
|
||||
else
|
||||
@ -189,14 +189,14 @@ int LogTable::AddColumn(const std::string& column_name,
|
||||
}
|
||||
|
||||
void LogTable::NextRow() {
|
||||
CriticalSectionScoped sync_rows(*table_lock_);
|
||||
CriticalSectionScoped sync_rows(table_lock_);
|
||||
rows_history_->push_back(current_row_);
|
||||
current_row_ = new Row;
|
||||
}
|
||||
|
||||
int LogTable::InsertCell(const std::string& column_name,
|
||||
const Container* value_container) {
|
||||
CriticalSectionScoped synchronize(*table_lock_);
|
||||
CriticalSectionScoped synchronize(table_lock_);
|
||||
assert(columns_.count(column_name) > 0);
|
||||
if (columns_.count(column_name) == 0)
|
||||
return -1;
|
||||
@ -222,7 +222,7 @@ void LogTable::Flush() {
|
||||
ColumnMap::iterator column_it;
|
||||
bool commit_header = false;
|
||||
if (write_header_) {
|
||||
CriticalSectionScoped synchronize(*table_lock_);
|
||||
CriticalSectionScoped synchronize(table_lock_);
|
||||
if (write_header_) {
|
||||
commit_header = true;
|
||||
write_header_ = false;
|
||||
@ -250,7 +250,7 @@ void LogTable::Flush() {
|
||||
// calls this function while we are writing.
|
||||
// We don't want to block the list while we're writing to file.
|
||||
{
|
||||
CriticalSectionScoped synchronize(*table_lock_);
|
||||
CriticalSectionScoped synchronize(table_lock_);
|
||||
RowList* tmp = rows_flush_;
|
||||
rows_flush_ = rows_history_;
|
||||
rows_history_ = tmp;
|
||||
@ -340,7 +340,7 @@ DataLogImpl::~DataLogImpl() {
|
||||
}
|
||||
|
||||
int DataLogImpl::CreateLog() {
|
||||
CriticalSectionScoped synchronize(*crit_sect_);
|
||||
CriticalSectionScoped synchronize(crit_sect_);
|
||||
if (instance_ == NULL) {
|
||||
instance_ = new DataLogImpl();
|
||||
return instance_->Init();
|
||||
@ -370,7 +370,7 @@ DataLogImpl* DataLogImpl::StaticInstance() {
|
||||
}
|
||||
|
||||
void DataLogImpl::ReturnLog() {
|
||||
CriticalSectionScoped synchronize(*crit_sect_);
|
||||
CriticalSectionScoped synchronize(crit_sect_);
|
||||
if (instance_ && instance_->counter_ > 1) {
|
||||
--instance_->counter_;
|
||||
return;
|
||||
|
@ -79,7 +79,7 @@ unsigned int ListWrapper::GetSize() const
|
||||
int ListWrapper::PushBack(const void* ptr)
|
||||
{
|
||||
ListItem* item = new ListItem(ptr);
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
PushBackImpl(item);
|
||||
return 0;
|
||||
}
|
||||
@ -87,7 +87,7 @@ int ListWrapper::PushBack(const void* ptr)
|
||||
int ListWrapper::PushBack(const unsigned int item_id)
|
||||
{
|
||||
ListItem* item = new ListItem(item_id);
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
PushBackImpl(item);
|
||||
return 0;
|
||||
}
|
||||
@ -95,7 +95,7 @@ int ListWrapper::PushBack(const unsigned int item_id)
|
||||
int ListWrapper::PushFront(const unsigned int item_id)
|
||||
{
|
||||
ListItem* item = new ListItem(item_id);
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
PushFrontImpl(item);
|
||||
return 0;
|
||||
}
|
||||
@ -103,7 +103,7 @@ int ListWrapper::PushFront(const unsigned int item_id)
|
||||
int ListWrapper::PushFront(const void* ptr)
|
||||
{
|
||||
ListItem* item = new ListItem(ptr);
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
PushFrontImpl(item);
|
||||
return 0;
|
||||
}
|
||||
@ -159,7 +159,7 @@ int ListWrapper::Insert(ListItem* existing_previous_item, ListItem* new_item)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
if (!existing_previous_item)
|
||||
{
|
||||
PushBackImpl(new_item);
|
||||
@ -195,7 +195,7 @@ int ListWrapper::InsertBefore(ListItem* existing_next_item,
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
if (!existing_next_item)
|
||||
{
|
||||
PushBackImpl(new_item);
|
||||
|
@ -75,7 +75,7 @@ int MapNoStl::Insert(int id, void* ptr)
|
||||
{
|
||||
MapNoStlItem* new_item = new MapNoStlItem(id, ptr);
|
||||
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
MapNoStlItem* item = first_;
|
||||
size_++;
|
||||
if (!item)
|
||||
@ -144,7 +144,7 @@ MapNoStlItem* MapNoStl::Previous(MapNoStlItem* item) const
|
||||
|
||||
MapNoStlItem* MapNoStl::Find(int id) const
|
||||
{
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
MapNoStlItem* item = Locate(id);
|
||||
return item;
|
||||
}
|
||||
@ -155,13 +155,13 @@ int MapNoStl::Erase(MapNoStlItem* item)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
return Remove(item);
|
||||
}
|
||||
|
||||
int MapNoStl::Erase(const int id)
|
||||
{
|
||||
CriticalSectionScoped lock(*critical_section_);
|
||||
CriticalSectionScoped lock(critical_section_);
|
||||
MapNoStlItem* item = Locate(id);
|
||||
if(!item)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ TraceImpl* TraceImpl::CreateInstance()
|
||||
}
|
||||
|
||||
TraceImpl::TraceImpl()
|
||||
: _critsectInterface(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
: _critsectInterface(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_callback(NULL),
|
||||
_rowCountText(0),
|
||||
_fileCountText(0),
|
||||
@ -76,7 +76,7 @@ TraceImpl::TraceImpl()
|
||||
_thread(*ThreadWrapper::CreateThread(TraceImpl::Run, this,
|
||||
kHighestPriority, "Trace")),
|
||||
_event(*EventWrapper::Create()),
|
||||
_critsectArray(*CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_critsectArray(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_nextFreeIdx(),
|
||||
_level(),
|
||||
_length(),
|
||||
@ -135,8 +135,8 @@ TraceImpl::~TraceImpl()
|
||||
delete &_event;
|
||||
delete &_traceFile;
|
||||
delete &_thread;
|
||||
delete &_critsectInterface;
|
||||
delete &_critsectArray;
|
||||
delete _critsectInterface;
|
||||
delete _critsectArray;
|
||||
|
||||
for(int m = 0; m < WEBRTC_TRACE_NUM_ARRAY; m++)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
|
||||
void WriteToFile();
|
||||
|
||||
CriticalSectionWrapper& _critsectInterface;
|
||||
CriticalSectionWrapper* _critsectInterface;
|
||||
TraceCallback* _callback;
|
||||
WebRtc_UWord32 _rowCountText;
|
||||
WebRtc_UWord32 _fileCountText;
|
||||
@ -119,7 +119,7 @@ private:
|
||||
EventWrapper& _event;
|
||||
|
||||
// _critsectArray protects _activeQueue
|
||||
CriticalSectionWrapper& _critsectArray;
|
||||
CriticalSectionWrapper* _critsectArray;
|
||||
WebRtc_UWord16 _nextFreeIdx[WEBRTC_TRACE_NUM_ARRAY];
|
||||
TraceLevel _level[WEBRTC_TRACE_NUM_ARRAY][WEBRTC_TRACE_MAX_QUEUE];
|
||||
WebRtc_UWord16 _length[WEBRTC_TRACE_NUM_ARRAY][WEBRTC_TRACE_MAX_QUEUE];
|
||||
|
Loading…
Reference in New Issue
Block a user