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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 649533003: C++11 declares a type safe null pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Presubmit errors Created 6 years, 2 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 "content/common/gpu/client/gpu_channel_host.h" 5 #include "content/common/gpu/client/gpu_channel_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 const gpu::GPUInfo& gpu_info) 66 const gpu::GPUInfo& gpu_info)
67 : factory_(factory), 67 : factory_(factory),
68 gpu_info_(gpu_info) { 68 gpu_info_(gpu_info) {
69 next_transfer_buffer_id_.GetNext(); 69 next_transfer_buffer_id_.GetNext();
70 next_gpu_memory_buffer_id_.GetNext(); 70 next_gpu_memory_buffer_id_.GetNext();
71 next_route_id_.GetNext(); 71 next_route_id_.GetNext();
72 } 72 }
73 73
74 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle, 74 void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle,
75 base::WaitableEvent* shutdown_event) { 75 base::WaitableEvent* shutdown_event) {
76 // Open a channel to the GPU process. We pass NULL as the main listener here 76 // Open a channel to the GPU process. We pass nullptr as the main listener
77 // since we need to filter everything to route it to the right thread. 77 // here since we need to filter everything to route it to the right thread.
78 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); 78 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
79 channel_ = IPC::SyncChannel::Create(channel_handle, 79 channel_ = IPC::SyncChannel::Create(channel_handle,
80 IPC::Channel::MODE_CLIENT, 80 IPC::Channel::MODE_CLIENT,
81 NULL, 81 nullptr,
82 io_loop.get(), 82 io_loop.get(),
83 true, 83 true,
84 shutdown_event); 84 shutdown_event);
85 85
86 sync_filter_ = new IPC::SyncMessageFilter(shutdown_event); 86 sync_filter_ = new IPC::SyncMessageFilter(shutdown_event);
87 87
88 channel_->AddFilter(sync_filter_.get()); 88 channel_->AddFilter(sync_filter_.get());
89 89
90 channel_filter_ = new MessageFilter(); 90 channel_filter_ = new MessageFilter();
91 91
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 DCHECK(MessageLoopProxy::current().get()); 158 DCHECK(MessageLoopProxy::current().get());
159 159
160 scoped_refptr<base::MessageLoopProxy> io_loop = 160 scoped_refptr<base::MessageLoopProxy> io_loop =
161 factory_->GetIOLoopProxy(); 161 factory_->GetIOLoopProxy();
162 io_loop->PostTask( 162 io_loop->PostTask(
163 FROM_HERE, 163 FROM_HERE,
164 base::Bind(&GpuChannelHost::MessageFilter::OnChannelError, 164 base::Bind(&GpuChannelHost::MessageFilter::OnChannelError,
165 channel_filter_.get())); 165 channel_filter_.get()));
166 } 166 }
167 167
168 return NULL; 168 return nullptr;
169 } 169 }
170 170
171 CommandBufferProxyImpl* command_buffer = 171 CommandBufferProxyImpl* command_buffer =
172 new CommandBufferProxyImpl(this, route_id); 172 new CommandBufferProxyImpl(this, route_id);
173 AddRoute(route_id, command_buffer->AsWeakPtr()); 173 AddRoute(route_id, command_buffer->AsWeakPtr());
174 174
175 AutoLock lock(context_lock_); 175 AutoLock lock(context_lock_);
176 proxies_[route_id] = command_buffer; 176 proxies_[route_id] = command_buffer;
177 return command_buffer; 177 return command_buffer;
178 } 178 }
(...skipping 12 matching lines...) Expand all
191 init_params.attribs = attribs; 191 init_params.attribs = attribs;
192 init_params.active_url = active_url; 192 init_params.active_url = active_url;
193 init_params.gpu_preference = gpu_preference; 193 init_params.gpu_preference = gpu_preference;
194 int32 route_id = GenerateRouteID(); 194 int32 route_id = GenerateRouteID();
195 bool succeeded = false; 195 bool succeeded = false;
196 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, 196 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size,
197 init_params, 197 init_params,
198 route_id, 198 route_id,
199 &succeeded))) { 199 &succeeded))) {
200 LOG(ERROR) << "Failed to send GpuChannelMsg_CreateOffscreenCommandBuffer."; 200 LOG(ERROR) << "Failed to send GpuChannelMsg_CreateOffscreenCommandBuffer.";
201 return NULL; 201 return nullptr;
202 } 202 }
203 203
204 if (!succeeded) { 204 if (!succeeded) {
205 LOG(ERROR) 205 LOG(ERROR)
206 << "GpuChannelMsg_CreateOffscreenCommandBuffer returned failure."; 206 << "GpuChannelMsg_CreateOffscreenCommandBuffer returned failure.";
207 return NULL; 207 return nullptr;
208 } 208 }
209 209
210 CommandBufferProxyImpl* command_buffer = 210 CommandBufferProxyImpl* command_buffer =
211 new CommandBufferProxyImpl(this, route_id); 211 new CommandBufferProxyImpl(this, route_id);
212 AddRoute(route_id, command_buffer->AsWeakPtr()); 212 AddRoute(route_id, command_buffer->AsWeakPtr());
213 213
214 AutoLock lock(context_lock_); 214 AutoLock lock(context_lock_);
215 proxies_[route_id] = command_buffer; 215 proxies_[route_id] = command_buffer;
216 return command_buffer; 216 return command_buffer;
217 } 217 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 406
407 listeners_.clear(); 407 listeners_.clear();
408 } 408 }
409 409
410 bool GpuChannelHost::MessageFilter::IsLost() const { 410 bool GpuChannelHost::MessageFilter::IsLost() const {
411 AutoLock lock(lock_); 411 AutoLock lock(lock_);
412 return lost_; 412 return lost_;
413 } 413 }
414 414
415 } // namespace content 415 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gl_helper_unittest.cc ('k') | content/common/gpu/client/gpu_in_process_context_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698