Chromium Code Reviews| 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/ipc/client/gpu_channel_host.h" | 5 #include "gpu/ipc/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "gpu/ipc/common/gpu_messages.h" | 17 #include "gpu/ipc/common/gpu_messages.h" |
| 18 #include "gpu/ipc/common/gpu_param_traits_macros.h" | 18 #include "gpu/ipc/common/gpu_param_traits_macros.h" |
| 19 #include "ipc/ipc_sync_message_filter.h" | 19 #include "ipc/ipc_sync_message_filter.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 using base::AutoLock; | 22 using base::AutoLock; |
| 23 | 23 |
| 24 namespace gpu { | 24 namespace gpu { |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Global atomic to generate unique transfer buffer IDs. | 27 // Global atomic to generate unique transfer buffer IDs. |
| 28 base::StaticAtomicSequenceNumber g_next_transfer_buffer_id; | 28 base::StaticAtomicSequenceNumber g_next_transfer_buffer_id; |
| 29 | 29 |
| 30 GpuChannelEstablishFactory* g_creator_factory = nullptr; | |
|
piman
2016/08/02 03:14:45
I would like to avoid globals in GPU code. This br
| |
| 31 | |
| 30 } // namespace | 32 } // namespace |
| 31 | 33 |
| 34 void GpuChannelEstablishFactory::SetInstance( | |
| 35 GpuChannelEstablishFactory* factory) { | |
| 36 DCHECK(!g_creator_factory || !factory) | |
| 37 << "You cannot set a new factory while an old factory is still alive."; | |
| 38 g_creator_factory = factory; | |
| 39 } | |
| 40 | |
| 41 GpuChannelEstablishFactory* GpuChannelEstablishFactory::GetInstance() { | |
| 42 return g_creator_factory; | |
| 43 } | |
| 44 | |
| 32 GpuChannelHost::StreamFlushInfo::StreamFlushInfo() | 45 GpuChannelHost::StreamFlushInfo::StreamFlushInfo() |
| 33 : next_stream_flush_id(1), | 46 : next_stream_flush_id(1), |
| 34 flushed_stream_flush_id(0), | 47 flushed_stream_flush_id(0), |
| 35 verified_stream_flush_id(0), | 48 verified_stream_flush_id(0), |
| 36 flush_pending(false), | 49 flush_pending(false), |
| 37 route_id(MSG_ROUTING_NONE), | 50 route_id(MSG_ROUTING_NONE), |
| 38 put_offset(0), | 51 put_offset(0), |
| 39 flush_count(0), | 52 flush_count(0), |
| 40 flush_id(0) {} | 53 flush_id(0) {} |
| 41 | 54 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 | 433 |
| 421 listeners_.clear(); | 434 listeners_.clear(); |
| 422 } | 435 } |
| 423 | 436 |
| 424 bool GpuChannelHost::MessageFilter::IsLost() const { | 437 bool GpuChannelHost::MessageFilter::IsLost() const { |
| 425 AutoLock lock(lock_); | 438 AutoLock lock(lock_); |
| 426 return lost_; | 439 return lost_; |
| 427 } | 440 } |
| 428 | 441 |
| 429 } // namespace gpu | 442 } // namespace gpu |
| OLD | NEW |