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

Unified Diff: skia/ports/SkThread_pthread.cpp

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | « skia/ports/SkThread_none.cpp ('k') | skia/ports/SkThread_win.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ports/SkThread_pthread.cpp
===================================================================
--- skia/ports/SkThread_pthread.cpp (revision 16859)
+++ skia/ports/SkThread_pthread.cpp (working copy)
@@ -1,90 +0,0 @@
-#include "SkThread.h"
-
-#include <pthread.h>
-#include <errno.h>
-
-SkMutex gAtomicMutex;
-
-int32_t sk_atomic_inc(int32_t* addr)
-{
- SkAutoMutexAcquire ac(gAtomicMutex);
-
- int32_t value = *addr;
- *addr = value + 1;
- return value;
-}
-
-int32_t sk_atomic_dec(int32_t* addr)
-{
- SkAutoMutexAcquire ac(gAtomicMutex);
-
- int32_t value = *addr;
- *addr = value - 1;
- return value;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-static void print_pthread_error(int status)
-{
- switch (status) {
- case 0: // success
- break;
- case EINVAL:
- printf("pthread error [%d] EINVAL\n", status);
- break;
- case EBUSY:
- printf("pthread error [%d] EBUSY\n", status);
- break;
- default:
- printf("pthread error [%d] unknown\n", status);
- break;
- }
-}
-
-SkMutex::SkMutex(bool isGlobal) : fIsGlobal(isGlobal)
-{
- if (sizeof(pthread_mutex_t) > sizeof(fStorage))
- {
- SkDEBUGF(("pthread mutex size = %d\n", sizeof(pthread_mutex_t)));
- SkASSERT(!"mutex storage is too small");
- }
-
- int status;
- pthread_mutexattr_t attr;
-
- status = pthread_mutexattr_init(&attr);
- print_pthread_error(status);
- SkASSERT(0 == status);
-
- status = pthread_mutex_init((pthread_mutex_t*)fStorage, &attr);
- print_pthread_error(status);
- SkASSERT(0 == status);
-}
-
-SkMutex::~SkMutex()
-{
- int status = pthread_mutex_destroy((pthread_mutex_t*)fStorage);
-
- // only report errors on non-global mutexes
- if (!fIsGlobal)
- {
- print_pthread_error(status);
- SkASSERT(0 == status);
- }
-}
-
-void SkMutex::acquire()
-{
- int status = pthread_mutex_lock((pthread_mutex_t*)fStorage);
- print_pthread_error(status);
- SkASSERT(0 == status);
-}
-
-void SkMutex::release()
-{
- int status = pthread_mutex_unlock((pthread_mutex_t*)fStorage);
- print_pthread_error(status);
- SkASSERT(0 == status);
-}
-
« no previous file with comments | « skia/ports/SkThread_none.cpp ('k') | skia/ports/SkThread_win.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698