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

Side by Side Diff: gpu/ipc/service/gpu_channel_manager.cc

Issue 2601993002: Remove base::ScopedPtrHashMap from gpu/ipc/service/. (Closed)
Patch Set: Created 3 years, 11 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
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/service/gpu_channel_manager.h" 5 #include "gpu/ipc/service/gpu_channel_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return framebuffer_completeness_cache_.get(); 113 return framebuffer_completeness_cache_.get();
114 } 114 }
115 115
116 void GpuChannelManager::RemoveChannel(int client_id) { 116 void GpuChannelManager::RemoveChannel(int client_id) {
117 delegate_->DidDestroyChannel(client_id); 117 delegate_->DidDestroyChannel(client_id);
118 gpu_channels_.erase(client_id); 118 gpu_channels_.erase(client_id);
119 } 119 }
120 120
121 GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { 121 GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const {
122 const auto& it = gpu_channels_.find(client_id); 122 const auto& it = gpu_channels_.find(client_id);
123 return it != gpu_channels_.end() ? it->second : nullptr; 123 return it != gpu_channels_.end() ? it->second.get() : nullptr;
124 } 124 }
125 125
126 std::unique_ptr<GpuChannel> GpuChannelManager::CreateGpuChannel( 126 std::unique_ptr<GpuChannel> GpuChannelManager::CreateGpuChannel(
127 int client_id, 127 int client_id,
128 uint64_t client_tracing_id, 128 uint64_t client_tracing_id,
129 bool preempts, 129 bool preempts,
130 bool allow_view_command_buffers, 130 bool allow_view_command_buffers,
131 bool allow_real_time_streams) { 131 bool allow_real_time_streams) {
132 return base::MakeUnique<GpuChannel>( 132 return base::MakeUnique<GpuChannel>(
133 this, sync_point_manager(), watchdog_, share_group(), mailbox_manager(), 133 this, sync_point_manager(), watchdog_, share_group(), mailbox_manager(),
134 preempts ? preemption_flag() : nullptr, 134 preempts ? preemption_flag() : nullptr,
135 preempts ? nullptr : preemption_flag(), task_runner_.get(), 135 preempts ? nullptr : preemption_flag(), task_runner_.get(),
136 io_task_runner_.get(), client_id, client_tracing_id, 136 io_task_runner_.get(), client_id, client_tracing_id,
137 allow_view_command_buffers, allow_real_time_streams); 137 allow_view_command_buffers, allow_real_time_streams);
138 } 138 }
139 139
140 IPC::ChannelHandle GpuChannelManager::EstablishChannel( 140 IPC::ChannelHandle GpuChannelManager::EstablishChannel(
141 int client_id, 141 int client_id,
142 uint64_t client_tracing_id, 142 uint64_t client_tracing_id,
143 bool preempts, 143 bool preempts,
144 bool allow_view_command_buffers, 144 bool allow_view_command_buffers,
145 bool allow_real_time_streams) { 145 bool allow_real_time_streams) {
146 std::unique_ptr<GpuChannel> channel( 146 std::unique_ptr<GpuChannel> channel(
147 CreateGpuChannel(client_id, client_tracing_id, preempts, 147 CreateGpuChannel(client_id, client_tracing_id, preempts,
148 allow_view_command_buffers, allow_real_time_streams)); 148 allow_view_command_buffers, allow_real_time_streams));
149 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_); 149 IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_);
150 gpu_channels_.set(client_id, std::move(channel)); 150 gpu_channels_[client_id] = std::move(channel);
151 return channel_handle; 151 return channel_handle;
152 } 152 }
153 153
154 void GpuChannelManager::InternalDestroyGpuMemoryBuffer( 154 void GpuChannelManager::InternalDestroyGpuMemoryBuffer(
155 gfx::GpuMemoryBufferId id, 155 gfx::GpuMemoryBufferId id,
156 int client_id) { 156 int client_id) {
157 io_task_runner_->PostTask( 157 io_task_runner_->PostTask(
158 FROM_HERE, 158 FROM_HERE,
159 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBufferOnIO, 159 base::Bind(&GpuChannelManager::InternalDestroyGpuMemoryBufferOnIO,
160 base::Unretained(this), id, client_id)); 160 base::Unretained(this), id, client_id));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 269 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
270 FROM_HERE, base::Bind(&GpuChannelManager::ScheduleWakeUpGpu, 270 FROM_HERE, base::Bind(&GpuChannelManager::ScheduleWakeUpGpu,
271 weak_factory_.GetWeakPtr()), 271 weak_factory_.GetWeakPtr()),
272 base::TimeDelta::FromMilliseconds(kMaxGpuIdleTimeMs)); 272 base::TimeDelta::FromMilliseconds(kMaxGpuIdleTimeMs));
273 } 273 }
274 274
275 void GpuChannelManager::DoWakeUpGpu() { 275 void GpuChannelManager::DoWakeUpGpu() {
276 const GpuCommandBufferStub* stub = nullptr; 276 const GpuCommandBufferStub* stub = nullptr;
277 for (const auto& kv : gpu_channels_) { 277 for (const auto& kv : gpu_channels_) {
278 const GpuChannel* channel = kv.second; 278 const GpuChannel* channel = kv.second.get();
279 stub = channel->GetOneStub(); 279 stub = channel->GetOneStub();
280 if (stub) { 280 if (stub) {
281 DCHECK(stub->decoder()); 281 DCHECK(stub->decoder());
282 break; 282 break;
283 } 283 }
284 } 284 }
285 if (!stub || !stub->decoder()->MakeCurrent()) 285 if (!stub || !stub->decoder()->MakeCurrent())
286 return; 286 return;
287 glFinish(); 287 glFinish();
288 DidAccessGpu(); 288 DidAccessGpu();
289 } 289 }
290 #endif 290 #endif
291 291
292 } // namespace gpu 292 } // namespace gpu
OLDNEW
« gpu/ipc/service/gpu_channel.cc ('K') | « gpu/ipc/service/gpu_channel_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698