remove unused bool param to SkMutex constructor

git-svn-id: http://skia.googlecode.com/svn/trunk@3025 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-01-12 15:21:16 +00:00
Родитель 2eba795bcd
Коммит dcbd6e358a
4 изменённых файлов: 26 добавлений и 52 удалений

Просмотреть файл

@ -59,9 +59,7 @@ SK_API int32_t sk_atomic_dec(int32_t* addr);
class SkMutex : android::Mutex {
public:
// if isGlobal is true, then ignore any errors in the platform-specific
// destructor
SkMutex(bool isGlobal = true) {}
SkMutex() {}
~SkMutex() {}
void acquire() { this->lock(); }
@ -82,9 +80,7 @@ SK_API int32_t sk_atomic_dec(int32_t* addr);
class SkMutex {
public:
// if isGlobal is true, then ignore any errors in the platform-specific
// destructor
SkMutex(bool isGlobal = true);
SkMutex();
~SkMutex();
void acquire();

Просмотреть файл

@ -9,33 +9,23 @@
#include "SkThread.h"
int32_t sk_atomic_inc(int32_t* addr)
{
int32_t sk_atomic_inc(int32_t* addr) {
int32_t value = *addr;
*addr = value + 1;
return value;
}
int32_t sk_atomic_dec(int32_t* addr)
{
int32_t sk_atomic_dec(int32_t* addr) {
int32_t value = *addr;
*addr = value - 1;
return value;
}
SkMutex::SkMutex(bool /* isGlobal */)
{
}
SkMutex::SkMutex() {}
SkMutex::~SkMutex()
{
}
SkMutex::~SkMutex() {}
void SkMutex::acquire()
{
}
void SkMutex::acquire() {}
void SkMutex::release()
{
}
void SkMutex::release() {}

Просмотреть файл

@ -67,27 +67,24 @@ int32_t sk_atomic_dec(int32_t* addr)
//////////////////////////////////////////////////////////////////////////////
static void print_pthread_error(int status)
{
static void print_pthread_error(int status) {
switch (status) {
case 0: // success
break;
case EINVAL:
printf("pthread error [%d] EINVAL\n", status);
SkDebugf("pthread error [%d] EINVAL\n", status);
break;
case EBUSY:
printf("pthread error [%d] EBUSY\n", status);
SkDebugf("pthread error [%d] EBUSY\n", status);
break;
default:
printf("pthread error [%d] unknown\n", status);
SkDebugf("pthread error [%d] unknown\n", status);
break;
}
}
SkMutex::SkMutex(bool isGlobal) : fIsGlobal(isGlobal)
{
if (sizeof(pthread_mutex_t) > sizeof(fStorage))
{
SkMutex::SkMutex() {
if (sizeof(pthread_mutex_t) > sizeof(fStorage)) {
SkDEBUGF(("pthread mutex size = %d\n", sizeof(pthread_mutex_t)));
SkDEBUGFAIL("mutex storage is too small");
}
@ -104,27 +101,24 @@ SkMutex::SkMutex(bool isGlobal) : fIsGlobal(isGlobal)
SkASSERT(0 == status);
}
SkMutex::~SkMutex()
{
SkMutex::~SkMutex() {
int status = pthread_mutex_destroy((pthread_mutex_t*)fStorage);
#if 0
// only report errors on non-global mutexes
if (!fIsGlobal)
{
if (!fIsGlobal) {
print_pthread_error(status);
SkASSERT(0 == status);
}
#endif
}
void SkMutex::acquire()
{
void SkMutex::acquire() {
int status = pthread_mutex_lock((pthread_mutex_t*)fStorage);
print_pthread_error(status);
SkASSERT(0 == status);
}
void SkMutex::release()
{
void SkMutex::release() {
int status = pthread_mutex_unlock((pthread_mutex_t*)fStorage);
print_pthread_error(status);
SkASSERT(0 == status);

Просмотреть файл

@ -10,36 +10,30 @@
#include <windows.h>
#include "SkThread.h"
int32_t sk_atomic_inc(int32_t* addr)
{
int32_t sk_atomic_inc(int32_t* addr) {
// InterlockedIncrement returns the new value, we want to return the old.
return InterlockedIncrement(reinterpret_cast<LONG*>(addr)) - 1;
}
int32_t sk_atomic_dec(int32_t* addr)
{
int32_t sk_atomic_dec(int32_t* addr) {
return InterlockedDecrement(reinterpret_cast<LONG*>(addr)) + 1;
}
SkMutex::SkMutex(bool /* isGlobal */)
{
SkMutex::SkMutex() {
SK_COMPILE_ASSERT(sizeof(fStorage) > sizeof(CRITICAL_SECTION),
NotEnoughSizeForCriticalSection);
InitializeCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&fStorage));
}
SkMutex::~SkMutex()
{
SkMutex::~SkMutex() {
DeleteCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&fStorage));
}
void SkMutex::acquire()
{
void SkMutex::acquire() {
EnterCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&fStorage));
}
void SkMutex::release()
{
void SkMutex::release() {
LeaveCriticalSection(reinterpret_cast<CRITICAL_SECTION*>(&fStorage));
}