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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 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') | gpu/ipc/client/gpu_memory_buffer_impl.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/location.h" 12 #include "base/location.h"
13 #include "base/memory/ptr_util.h"
13 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
14 #include "base/profiler/scoped_tracker.h" 15 #include "base/profiler/scoped_tracker.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
17 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
18 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 21 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
21 #include "gpu/ipc/common/gpu_messages.h" 22 #include "gpu/ipc/common/gpu_messages.h"
22 #include "gpu/ipc/common/gpu_param_traits_macros.h" 23 #include "gpu/ipc/common/gpu_param_traits_macros.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 channel_filter_ = new MessageFilter(); 94 channel_filter_ = new MessageFilter();
94 95
95 // Install the filter last, because we intercept all leftover 96 // Install the filter last, because we intercept all leftover
96 // messages. 97 // messages.
97 channel_->AddFilter(channel_filter_.get()); 98 channel_->AddFilter(channel_filter_.get());
98 } 99 }
99 100
100 bool GpuChannelHost::Send(IPC::Message* msg) { 101 bool GpuChannelHost::Send(IPC::Message* msg) {
101 // Callee takes ownership of message, regardless of whether Send is 102 // Callee takes ownership of message, regardless of whether Send is
102 // successful. See IPC::Sender. 103 // successful. See IPC::Sender.
103 scoped_ptr<IPC::Message> message(msg); 104 std::unique_ptr<IPC::Message> message(msg);
104 // The GPU process never sends synchronous IPCs so clear the unblock flag to 105 // The GPU process never sends synchronous IPCs so clear the unblock flag to
105 // preserve order. 106 // preserve order.
106 message->set_unblock(false); 107 message->set_unblock(false);
107 108
108 // Currently we need to choose between two different mechanisms for sending. 109 // Currently we need to choose between two different mechanisms for sending.
109 // On the main thread we use the regular channel Send() method, on another 110 // On the main thread we use the regular channel Send() method, on another
110 // thread we use SyncMessageFilter. We also have to be careful interpreting 111 // thread we use SyncMessageFilter. We also have to be careful interpreting
111 // IsMainThread() since it might return false during shutdown, 112 // IsMainThread() since it might return false during shutdown,
112 // impl we are actually calling from the main thread (discard message then). 113 // impl we are actually calling from the main thread (discard message then).
113 // 114 //
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 DCHECK_LT(flush_info->flushed_stream_flush_id, flush_info->flush_id); 182 DCHECK_LT(flush_info->flushed_stream_flush_id, flush_info->flush_id);
182 Send(new GpuCommandBufferMsg_AsyncFlush( 183 Send(new GpuCommandBufferMsg_AsyncFlush(
183 flush_info->route_id, flush_info->put_offset, flush_info->flush_count, 184 flush_info->route_id, flush_info->put_offset, flush_info->flush_count,
184 flush_info->latency_info)); 185 flush_info->latency_info));
185 flush_info->latency_info.clear(); 186 flush_info->latency_info.clear();
186 flush_info->flush_pending = false; 187 flush_info->flush_pending = false;
187 188
188 flush_info->flushed_stream_flush_id = flush_info->flush_id; 189 flush_info->flushed_stream_flush_id = flush_info->flush_id;
189 } 190 }
190 191
191 scoped_ptr<CommandBufferProxyImpl> GpuChannelHost::CreateCommandBuffer( 192 std::unique_ptr<CommandBufferProxyImpl> GpuChannelHost::CreateCommandBuffer(
192 gpu::SurfaceHandle surface_handle, 193 gpu::SurfaceHandle surface_handle,
193 const gfx::Size& size, 194 const gfx::Size& size,
194 CommandBufferProxyImpl* share_group, 195 CommandBufferProxyImpl* share_group,
195 int32_t stream_id, 196 int32_t stream_id,
196 gpu::GpuStreamPriority stream_priority, 197 gpu::GpuStreamPriority stream_priority,
197 const std::vector<int32_t>& attribs, 198 const std::vector<int32_t>& attribs,
198 const GURL& active_url, 199 const GURL& active_url,
199 gfx::GpuPreference gpu_preference) { 200 gfx::GpuPreference gpu_preference) {
200 DCHECK(!share_group || (stream_id == share_group->stream_id())); 201 DCHECK(!share_group || (stream_id == share_group->stream_id()));
201 TRACE_EVENT1("gpu", "GpuChannelHost::CreateViewCommandBuffer", 202 TRACE_EVENT1("gpu", "GpuChannelHost::CreateViewCommandBuffer",
(...skipping 25 matching lines...) Expand all
227 surface_handle, size, init_params, route_id, &succeeded))) { 228 surface_handle, size, init_params, route_id, &succeeded))) {
228 LOG(ERROR) << "Failed to send GpuChannelMsg_CreateCommandBuffer."; 229 LOG(ERROR) << "Failed to send GpuChannelMsg_CreateCommandBuffer.";
229 return nullptr; 230 return nullptr;
230 } 231 }
231 232
232 if (!succeeded) { 233 if (!succeeded) {
233 LOG(ERROR) << "GpuChannelMsg_CreateCommandBuffer returned failure."; 234 LOG(ERROR) << "GpuChannelMsg_CreateCommandBuffer returned failure.";
234 return nullptr; 235 return nullptr;
235 } 236 }
236 237
237 scoped_ptr<CommandBufferProxyImpl> command_buffer = 238 std::unique_ptr<CommandBufferProxyImpl> command_buffer =
238 make_scoped_ptr(new CommandBufferProxyImpl(this, route_id, stream_id)); 239 base::WrapUnique(new CommandBufferProxyImpl(this, route_id, stream_id));
239 AddRoute(route_id, command_buffer->AsWeakPtr()); 240 AddRoute(route_id, command_buffer->AsWeakPtr());
240 241
241 return command_buffer; 242 return command_buffer;
242 } 243 }
243 244
244 void GpuChannelHost::DestroyCommandBuffer( 245 void GpuChannelHost::DestroyCommandBuffer(
245 CommandBufferProxyImpl* command_buffer) { 246 CommandBufferProxyImpl* command_buffer) {
246 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); 247 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer");
247 248
248 int32_t route_id = command_buffer->route_id(); 249 int32_t route_id = command_buffer->route_id();
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 470
470 listeners_.clear(); 471 listeners_.clear();
471 } 472 }
472 473
473 bool GpuChannelHost::MessageFilter::IsLost() const { 474 bool GpuChannelHost::MessageFilter::IsLost() const {
474 AutoLock lock(lock_); 475 AutoLock lock(lock_);
475 return lost_; 476 return lost_;
476 } 477 }
477 478
478 } // namespace gpu 479 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_channel_host.h ('k') | gpu/ipc/client/gpu_memory_buffer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698