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

Side by Side Diff: gpu/ipc/client/command_buffer_proxy_impl.h

Issue 1933473002: Added more strict checks for fence sync counters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add thread_checker header Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | gpu/ipc/client/command_buffer_proxy_impl.cc » ('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 #ifndef GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 5 #ifndef GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
6 #define GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 6 #define GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <queue> 13 #include <queue>
14 #include <string> 14 #include <string>
15 15
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/containers/hash_tables.h" 18 #include "base/containers/hash_tables.h"
19 #include "base/containers/scoped_ptr_hash_map.h" 19 #include "base/containers/scoped_ptr_hash_map.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
23 #include "base/observer_list.h" 23 #include "base/observer_list.h"
24 #include "base/threading/thread_checker.h"
24 #include "gpu/command_buffer/client/gpu_control.h" 25 #include "gpu/command_buffer/client/gpu_control.h"
25 #include "gpu/command_buffer/common/command_buffer.h" 26 #include "gpu/command_buffer/common/command_buffer.h"
26 #include "gpu/command_buffer/common/command_buffer_id.h" 27 #include "gpu/command_buffer/common/command_buffer_id.h"
27 #include "gpu/command_buffer/common/command_buffer_shared.h" 28 #include "gpu/command_buffer/common/command_buffer_shared.h"
28 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 29 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
29 #include "gpu/gpu_export.h" 30 #include "gpu/gpu_export.h"
30 #include "ipc/ipc_listener.h" 31 #include "ipc/ipc_listener.h"
31 #include "ui/events/latency_info.h" 32 #include "ui/events/latency_info.h"
32 #include "ui/gfx/swap_result.h" 33 #include "ui/gfx/swap_result.h"
33 34
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::SharedMemoryHandle GetSharedStateHandle() const { 151 base::SharedMemoryHandle GetSharedStateHandle() const {
151 return shared_state_shm_->handle(); 152 return shared_state_shm_->handle();
152 } 153 }
153 uint32_t CreateStreamTexture(uint32_t texture_id); 154 uint32_t CreateStreamTexture(uint32_t texture_id);
154 155
155 private: 156 private:
156 typedef std::map<int32_t, scoped_refptr<gpu::Buffer>> TransferBufferMap; 157 typedef std::map<int32_t, scoped_refptr<gpu::Buffer>> TransferBufferMap;
157 typedef base::hash_map<uint32_t, base::Closure> SignalTaskMap; 158 typedef base::hash_map<uint32_t, base::Closure> SignalTaskMap;
158 159
159 void CheckLock() { 160 void CheckLock() {
160 if (lock_) 161 if (lock_) {
161 lock_->AssertAcquired(); 162 lock_->AssertAcquired();
163 } else {
164 DCHECK(lockless_thread_checker_.CalledOnValidThread());
165 }
162 } 166 }
163 167
164 // Send an IPC message over the GPU channel. This is private to fully 168 // Send an IPC message over the GPU channel. This is private to fully
165 // encapsulate the channel; all callers of this function must explicitly 169 // encapsulate the channel; all callers of this function must explicitly
166 // verify that the context has not been lost. 170 // verify that the context has not been lost.
167 bool Send(IPC::Message* msg); 171 bool Send(IPC::Message* msg);
168 172
169 // Message handlers: 173 // Message handlers:
170 void OnUpdateState(const gpu::CommandBuffer::State& state); 174 void OnUpdateState(const gpu::CommandBuffer::State& state);
171 void OnDestroyed(gpu::error::ContextLostReason reason, 175 void OnDestroyed(gpu::error::ContextLostReason reason,
(...skipping 17 matching lines...) Expand all
189 193
190 // Loses the context after we received an invalid reply from the GPU 194 // Loses the context after we received an invalid reply from the GPU
191 // process. Will post a task to call the lost context callback if any. 195 // process. Will post a task to call the lost context callback if any.
192 void InvalidGpuReply(); 196 void InvalidGpuReply();
193 197
194 void InvalidGpuReplyOnClientThread(); 198 void InvalidGpuReplyOnClientThread();
195 199
196 // The shared memory area used to update state. 200 // The shared memory area used to update state.
197 gpu::CommandBufferSharedState* shared_state() const; 201 gpu::CommandBufferSharedState* shared_state() const;
198 202
203 // There should be a lock_ if this is going to be used across multiple
204 // threads, or we guarantee it is used by a single thread by using a thread
205 // checker if no lock_ is set.
199 base::Lock* lock_; 206 base::Lock* lock_;
207 base::ThreadChecker lockless_thread_checker_;
200 208
201 // Client that wants to listen for important events on the GpuControl. 209 // Client that wants to listen for important events on the GpuControl.
202 gpu::GpuControlClient* gpu_control_client_; 210 gpu::GpuControlClient* gpu_control_client_;
203 211
204 // Unowned list of DeletionObservers. 212 // Unowned list of DeletionObservers.
205 base::ObserverList<DeletionObserver> deletion_observers_; 213 base::ObserverList<DeletionObserver> deletion_observers_;
206 214
207 // The last cached state received from the service. 215 // The last cached state received from the service.
208 State last_state_; 216 State last_state_;
209 217
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 255
248 base::WeakPtr<CommandBufferProxyImpl> weak_this_; 256 base::WeakPtr<CommandBufferProxyImpl> weak_this_;
249 scoped_refptr<base::SequencedTaskRunner> callback_thread_; 257 scoped_refptr<base::SequencedTaskRunner> callback_thread_;
250 258
251 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); 259 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl);
252 }; 260 };
253 261
254 } // namespace gpu 262 } // namespace gpu
255 263
256 #endif // GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ 264 #endif // GPU_IPC_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/ipc/client/command_buffer_proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698