summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/SkThread_chrome.cc45
-rw-r--r--skia/skia.gyp5
2 files changed, 48 insertions, 2 deletions
diff --git a/skia/ext/SkThread_chrome.cc b/skia/ext/SkThread_chrome.cc
new file mode 100644
index 0000000..4693309
--- /dev/null
+++ b/skia/ext/SkThread_chrome.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "third_party/skia/include/core/SkThread.h"
+
+#include <new>
+
+#include "base/atomicops.h"
+#include "base/basictypes.h"
+#include "base/lock.h"
+#include "base/logging.h"
+
+int32_t sk_atomic_inc(int32_t* addr) {
+ // sk_atomic_inc is expected to return the old value, Barrier_AtomicIncrement
+ // returns the new value.
+ return base::subtle::Barrier_AtomicIncrement(addr, 1) - 1;
+}
+
+int32_t sk_atomic_dec(int32_t* addr) {
+ // sk_atomic_inc is expected to return the old value, Barrier_AtomicIncrement
+ // returns the new value.
+ return base::subtle::Barrier_AtomicIncrement(addr, -1) + 1;
+}
+
+SkMutex::SkMutex(bool isGlobal) : fIsGlobal(isGlobal) {
+ COMPILE_ASSERT(sizeof(Lock) <= sizeof(fStorage), Lock_is_too_big_for_SkMutex);
+ Lock* lock = reinterpret_cast<Lock*>(fStorage);
+ new(lock) Lock();
+}
+
+SkMutex::~SkMutex() {
+ Lock* lock = reinterpret_cast<Lock*>(fStorage);
+ lock->~Lock();
+}
+
+void SkMutex::acquire() {
+ Lock* lock = reinterpret_cast<Lock*>(fStorage);
+ lock->Acquire();
+}
+
+void SkMutex::release() {
+ Lock* lock = reinterpret_cast<Lock*>(fStorage);
+ lock->Release();
+}
diff --git a/skia/skia.gyp b/skia/skia.gyp
index a873237..5be7398 100644
--- a/skia/skia.gyp
+++ b/skia/skia.gyp
@@ -375,7 +375,7 @@
#'../third_party/skia/src/ports/SkOSEvent_dummy.cpp',
'../third_party/skia/src/ports/SkOSFile_stdio.cpp',
#'../third_party/skia/src/ports/SkThread_none.cpp',
- '../third_party/skia/src/ports/SkThread_pthread.cpp',
+ #'../third_party/skia/src/ports/SkThread_pthread.cpp',
'../third_party/skia/src/ports/SkThread_win.cpp',
'../third_party/skia/src/ports/SkTime_Unix.cpp',
#'../third_party/skia/src/ports/SkXMLParser_empty.cpp',
@@ -512,6 +512,7 @@
'ext/google_logging.cc',
'ext/image_operations.cc',
'ext/image_operations.h',
+ 'ext/SkThread_chrome.cc',
'ext/platform_canvas.h',
'ext/platform_canvas.cc',
'ext/platform_canvas_linux.cc',
@@ -647,8 +648,8 @@
[ 'OS == "win"', {
'sources!': [
'../third_party/skia/src/core/SkMMapStream.cpp',
- '../third_party/skia/src/ports/SkThread_pthread.cpp',
'../third_party/skia/src/ports/SkTime_Unix.cc',
+ 'ext/SkThread_chrome.cc',
],
'include_dirs': [
'config/win',