| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/client/atomicops.h" | 5 #include "gpu/command_buffer/client/atomicops.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 #if !defined(__native_client__) | 9 #if !defined(__native_client__) |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #else | 12 #else |
| 13 #include <pthread.h> | 13 #include <pthread.h> |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace gpu { | 16 namespace gpu { |
| 17 | 17 |
| 18 void MemoryBarrier() { | |
| 19 #if defined(__native_client__) | |
| 20 __sync_synchronize(); | |
| 21 #else | |
| 22 base::subtle::MemoryBarrier(); | |
| 23 #endif | |
| 24 } | |
| 25 | |
| 26 #if defined(__native_client__) | 18 #if defined(__native_client__) |
| 27 | 19 |
| 28 class LockImpl { | 20 class LockImpl { |
| 29 public: | 21 public: |
| 30 LockImpl() | 22 LockImpl() |
| 31 : acquired_(false) { | 23 : acquired_(false) { |
| 32 pthread_mutex_init(&mutex_, NULL); | 24 pthread_mutex_init(&mutex_, NULL); |
| 33 } | 25 } |
| 34 | 26 |
| 35 ~LockImpl() { | 27 ~LockImpl() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bool Lock::Try() { | 83 bool Lock::Try() { |
| 92 return lock_->Try(); | 84 return lock_->Try(); |
| 93 } | 85 } |
| 94 | 86 |
| 95 void Lock::AssertAcquired() const { | 87 void Lock::AssertAcquired() const { |
| 96 return lock_->AssertAcquired(); | 88 return lock_->AssertAcquired(); |
| 97 } | 89 } |
| 98 | 90 |
| 99 } // namespace gpu | 91 } // namespace gpu |
| 100 | 92 |
| OLD | NEW |