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

Side by Side Diff: gpu/command_buffer/client/atomicops.cc

Issue 58913003: command_buffer: Remove hash_tables.h, simplify atomicops.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/client/atomicops.h ('k') | gpu/command_buffer/client/buffer_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/atomicops.h ('k') | gpu/command_buffer/client/buffer_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698