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

Side by Side Diff: gpu/ipc/client/gpu_channel_host.cc

Issue 2197613003: gpu: Introduce GpuChannelEstablishFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « gpu/ipc/client/gpu_channel_host.h ('k') | services/ui/common/gpu_service.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/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
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
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_channel_host.h ('k') | services/ui/common/gpu_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698