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

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

Issue 583043005: Pending tasks in a message loop should be deleted before shutting down Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « content/common/gpu/client/gpu_channel_host.h ('k') | content/renderer/render_thread_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 "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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 int route_id = command_buffer->GetRouteID(); 226 int route_id = command_buffer->GetRouteID();
227 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); 227 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id));
228 RemoveRoute(route_id); 228 RemoveRoute(route_id);
229 229
230 AutoLock lock(context_lock_); 230 AutoLock lock(context_lock_);
231 proxies_.erase(route_id); 231 proxies_.erase(route_id);
232 delete command_buffer; 232 delete command_buffer;
233 } 233 }
234 234
235 void GpuChannelHost::DestroyChannel() {
236 // channel_ must be destroyed on the main thread.
237 if (channel_.get() && !factory_->IsMainThread())
238 factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release());
239 channel_.reset();
240 }
241
235 void GpuChannelHost::AddRoute( 242 void GpuChannelHost::AddRoute(
236 int route_id, base::WeakPtr<IPC::Listener> listener) { 243 int route_id, base::WeakPtr<IPC::Listener> listener) {
237 DCHECK(MessageLoopProxy::current().get()); 244 DCHECK(MessageLoopProxy::current().get());
238 245
239 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy(); 246 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
240 io_loop->PostTask(FROM_HERE, 247 io_loop->PostTask(FROM_HERE,
241 base::Bind(&GpuChannelHost::MessageFilter::AddRoute, 248 base::Bind(&GpuChannelHost::MessageFilter::AddRoute,
242 channel_filter_.get(), route_id, listener, 249 channel_filter_.get(), route_id, listener,
243 MessageLoopProxy::current())); 250 MessageLoopProxy::current()));
244 } 251 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 311
305 int32 GpuChannelHost::ReserveImageId() { 312 int32 GpuChannelHost::ReserveImageId() {
306 return next_image_id_.GetNext(); 313 return next_image_id_.GetNext();
307 } 314 }
308 315
309 int32 GpuChannelHost::GenerateRouteID() { 316 int32 GpuChannelHost::GenerateRouteID() {
310 return next_route_id_.GetNext(); 317 return next_route_id_.GetNext();
311 } 318 }
312 319
313 GpuChannelHost::~GpuChannelHost() { 320 GpuChannelHost::~GpuChannelHost() {
314 // channel_ must be destroyed on the main thread. 321 DestroyChannel();
315 if (!factory_->IsMainThread())
316 factory_->GetMainLoop()->DeleteSoon(FROM_HERE, channel_.release());
317 } 322 }
318 323
319
320 GpuChannelHost::MessageFilter::MessageFilter() 324 GpuChannelHost::MessageFilter::MessageFilter()
321 : lost_(false) { 325 : lost_(false) {
322 } 326 }
323 327
324 GpuChannelHost::MessageFilter::~MessageFilter() {} 328 GpuChannelHost::MessageFilter::~MessageFilter() {}
325 329
326 void GpuChannelHost::MessageFilter::AddRoute( 330 void GpuChannelHost::MessageFilter::AddRoute(
327 int route_id, 331 int route_id,
328 base::WeakPtr<IPC::Listener> listener, 332 base::WeakPtr<IPC::Listener> listener,
329 scoped_refptr<MessageLoopProxy> loop) { 333 scoped_refptr<MessageLoopProxy> loop) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 386
383 listeners_.clear(); 387 listeners_.clear();
384 } 388 }
385 389
386 bool GpuChannelHost::MessageFilter::IsLost() const { 390 bool GpuChannelHost::MessageFilter::IsLost() const {
387 AutoLock lock(lock_); 391 AutoLock lock(lock_);
388 return lost_; 392 return lost_;
389 } 393 }
390 394
391 } // namespace content 395 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698