| OLD | NEW |
| 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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 // RenderThreadImpl. | 836 // RenderThreadImpl. |
| 837 embedded_worker_dispatcher_.reset(); | 837 embedded_worker_dispatcher_.reset(); |
| 838 | 838 |
| 839 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might | 839 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might |
| 840 // hold pointers to V8 objects (e.g., via pending requests). | 840 // hold pointers to V8 objects (e.g., via pending requests). |
| 841 main_thread_indexed_db_dispatcher_.reset(); | 841 main_thread_indexed_db_dispatcher_.reset(); |
| 842 | 842 |
| 843 main_thread_compositor_task_runner_ = NULL; | 843 main_thread_compositor_task_runner_ = NULL; |
| 844 | 844 |
| 845 // Context providers must be released prior to destroying the GPU channel. | 845 // Context providers must be released prior to destroying the GPU channel. |
| 846 if (shared_worker_context_provider_) { |
| 847 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
| 848 shared_worker_context_provider_->Destroy(); |
| 849 shared_worker_context_provider_ = nullptr; |
| 850 } |
| 846 gpu_va_context_provider_ = nullptr; | 851 gpu_va_context_provider_ = nullptr; |
| 847 shared_main_thread_contexts_ = nullptr; | 852 shared_main_thread_contexts_ = nullptr; |
| 848 | 853 |
| 849 if (gpu_channel_.get()) | 854 if (gpu_channel_.get()) |
| 850 gpu_channel_->DestroyChannel(); | 855 gpu_channel_->DestroyChannel(); |
| 851 | 856 |
| 852 // TODO(port) | 857 // TODO(port) |
| 853 #if defined(OS_WIN) | 858 #if defined(OS_WIN) |
| 854 // Clean up plugin channels before this thread goes away. | 859 // Clean up plugin channels before this thread goes away. |
| 855 NPChannelBase::CleanupChannels(); | 860 NPChannelBase::CleanupChannels(); |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 AddFilter(renderer_demuxer_.get()); | 1880 AddFilter(renderer_demuxer_.get()); |
| 1876 #endif | 1881 #endif |
| 1877 } | 1882 } |
| 1878 return media_thread_->task_runner(); | 1883 return media_thread_->task_runner(); |
| 1879 } | 1884 } |
| 1880 | 1885 |
| 1881 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { | 1886 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { |
| 1882 return raster_worker_pool_.get(); | 1887 return raster_worker_pool_.get(); |
| 1883 } | 1888 } |
| 1884 | 1889 |
| 1890 scoped_refptr<ContextProviderCommandBuffer> |
| 1891 RenderThreadImpl::SharedWorkerContextProvider() { |
| 1892 DCHECK(IsMainThread()); |
| 1893 // Try to reuse existing shared worker context provider. |
| 1894 if (shared_worker_context_provider_) { |
| 1895 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
| 1896 if (shared_worker_context_provider_->ContextGL() |
| 1897 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| 1898 shared_worker_context_provider_->Destroy(); |
| 1899 shared_worker_context_provider_ = nullptr; |
| 1900 } |
| 1901 } |
| 1902 if (!shared_worker_context_provider_) { |
| 1903 shared_worker_context_provider_ = ContextProviderCommandBuffer::Create( |
| 1904 CreateOffscreenContext3d(), RENDER_WORKER_CONTEXT); |
| 1905 if (shared_worker_context_provider_ && |
| 1906 !shared_worker_context_provider_->BindToCurrentThread()) |
| 1907 shared_worker_context_provider_ = nullptr; |
| 1908 if (shared_worker_context_provider_) |
| 1909 shared_worker_context_provider_->SetupLock(); |
| 1910 } |
| 1911 return shared_worker_context_provider_; |
| 1912 } |
| 1913 |
| 1885 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 1914 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
| 1886 blink_platform_impl_->sampleGamepads(*data); | 1915 blink_platform_impl_->sampleGamepads(*data); |
| 1887 } | 1916 } |
| 1888 | 1917 |
| 1889 bool RenderThreadImpl::RendererIsHidden() const { | 1918 bool RenderThreadImpl::RendererIsHidden() const { |
| 1890 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; | 1919 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; |
| 1891 } | 1920 } |
| 1892 | 1921 |
| 1893 void RenderThreadImpl::WidgetCreated() { | 1922 void RenderThreadImpl::WidgetCreated() { |
| 1894 bool renderer_was_hidden = RendererIsHidden(); | 1923 bool renderer_was_hidden = RendererIsHidden(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 } | 1996 } |
| 1968 | 1997 |
| 1969 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 1998 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 1970 size_t erased = | 1999 size_t erased = |
| 1971 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2000 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 1972 routing_id_); | 2001 routing_id_); |
| 1973 DCHECK_EQ(1u, erased); | 2002 DCHECK_EQ(1u, erased); |
| 1974 } | 2003 } |
| 1975 | 2004 |
| 1976 } // namespace content | 2005 } // namespace content |
| OLD | NEW |