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/service/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 : submit_count_(submit_count), cancelled_(false) {} | 30 : submit_count_(submit_count), cancelled_(false) {} |
31 | 31 |
32 void Cancel() { | 32 void Cancel() { |
33 base::AutoLock locked(lock_); | 33 base::AutoLock locked(lock_); |
34 cancelled_ = true; | 34 cancelled_ = true; |
35 } | 35 } |
36 | 36 |
37 virtual void DidComplete(const AsyncMemoryParams& mem_params) OVERRIDE { | 37 virtual void DidComplete(const AsyncMemoryParams& mem_params) OVERRIDE { |
38 base::AutoLock locked(lock_); | 38 base::AutoLock locked(lock_); |
39 if (!cancelled_) { | 39 if (!cancelled_) { |
40 DCHECK(mem_params.buffer()); | 40 DCHECK(mem_params.buffer().get()); |
41 void* data = mem_params.GetDataAddress(); | 41 void* data = mem_params.GetDataAddress(); |
42 QuerySync* sync = static_cast<QuerySync*>(data); | 42 QuerySync* sync = static_cast<QuerySync*>(data); |
43 base::subtle::Release_Store(&sync->process_count, submit_count_); | 43 base::subtle::Release_Store(&sync->process_count, submit_count_); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 virtual ~AsyncPixelTransferCompletionObserverImpl() {} | 48 virtual ~AsyncPixelTransferCompletionObserverImpl() {} |
49 | 49 |
50 base::subtle::Atomic32 submit_count_; | 50 base::subtle::Atomic32 submit_count_; |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { | 738 bool QueryManager::EndQuery(Query* query, base::subtle::Atomic32 submit_count) { |
739 DCHECK(query); | 739 DCHECK(query); |
740 if (!RemovePendingQuery(query)) { | 740 if (!RemovePendingQuery(query)) { |
741 return false; | 741 return false; |
742 } | 742 } |
743 return query->End(submit_count); | 743 return query->End(submit_count); |
744 } | 744 } |
745 | 745 |
746 } // namespace gles2 | 746 } // namespace gles2 |
747 } // namespace gpu | 747 } // namespace gpu |
OLD | NEW |