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

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 1128233004: Fix GpuChannelHost destruction and races (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « content/common/gpu/client/gpu_channel_host.cc ('k') | no next file » | 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/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 embedded_worker_dispatcher_.reset(); 783 embedded_worker_dispatcher_.reset();
784 784
785 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might 785 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might
786 // hold pointers to V8 objects (e.g., via pending requests). 786 // hold pointers to V8 objects (e.g., via pending requests).
787 main_thread_indexed_db_dispatcher_.reset(); 787 main_thread_indexed_db_dispatcher_.reset();
788 788
789 main_thread_compositor_task_runner_ = NULL; 789 main_thread_compositor_task_runner_ = NULL;
790 790
791 // Context providers must be released prior to destroying the GPU channel. 791 // Context providers must be released prior to destroying the GPU channel.
792 gpu_va_context_provider_ = nullptr; 792 gpu_va_context_provider_ = nullptr;
793 shared_main_thread_contexts_ = nullptr;
793 794
794 if (gpu_channel_.get()) 795 if (gpu_channel_.get())
795 gpu_channel_->DestroyChannel(); 796 gpu_channel_->DestroyChannel();
796 797
797 // TODO(port) 798 // TODO(port)
798 #if defined(OS_WIN) 799 #if defined(OS_WIN)
799 // Clean up plugin channels before this thread goes away. 800 // Clean up plugin channels before this thread goes away.
800 NPChannelBase::CleanupChannels(); 801 NPChannelBase::CleanupChannels();
801 #endif 802 #endif
802 803
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 CauseForGpuLaunch cause_for_gpu_launch) { 1599 CauseForGpuLaunch cause_for_gpu_launch) {
1599 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); 1600 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync");
1600 1601
1601 if (gpu_channel_.get()) { 1602 if (gpu_channel_.get()) {
1602 // Do nothing if we already have a GPU channel or are already 1603 // Do nothing if we already have a GPU channel or are already
1603 // establishing one. 1604 // establishing one.
1604 if (!gpu_channel_->IsLost()) 1605 if (!gpu_channel_->IsLost())
1605 return gpu_channel_.get(); 1606 return gpu_channel_.get();
1606 1607
1607 // Recreate the channel if it has been lost. 1608 // Recreate the channel if it has been lost.
1609 gpu_channel_->DestroyChannel();
1608 gpu_channel_ = NULL; 1610 gpu_channel_ = NULL;
1609 } 1611 }
1610 1612
1611 // Ask the browser for the channel name. 1613 // Ask the browser for the channel name.
1612 int client_id = 0; 1614 int client_id = 0;
1613 IPC::ChannelHandle channel_handle; 1615 IPC::ChannelHandle channel_handle;
1614 gpu::GPUInfo gpu_info; 1616 gpu::GPUInfo gpu_info;
1615 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch, 1617 if (!Send(new GpuHostMsg_EstablishGpuChannel(cause_for_gpu_launch,
1616 &client_id, 1618 &client_id,
1617 &channel_handle, 1619 &channel_handle,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 } 1901 }
1900 1902
1901 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { 1903 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() {
1902 size_t erased = 1904 size_t erased =
1903 RenderThreadImpl::current()->pending_render_frame_connects_.erase( 1905 RenderThreadImpl::current()->pending_render_frame_connects_.erase(
1904 routing_id_); 1906 routing_id_);
1905 DCHECK_EQ(1u, erased); 1907 DCHECK_EQ(1u, erased);
1906 } 1908 }
1907 1909
1908 } // namespace content 1910 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698