| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 // RenderThreadImpl. | 839 // RenderThreadImpl. |
| 840 embedded_worker_dispatcher_.reset(); | 840 embedded_worker_dispatcher_.reset(); |
| 841 | 841 |
| 842 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might | 842 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might |
| 843 // hold pointers to V8 objects (e.g., via pending requests). | 843 // hold pointers to V8 objects (e.g., via pending requests). |
| 844 main_thread_indexed_db_dispatcher_.reset(); | 844 main_thread_indexed_db_dispatcher_.reset(); |
| 845 | 845 |
| 846 main_thread_compositor_task_runner_ = NULL; | 846 main_thread_compositor_task_runner_ = NULL; |
| 847 | 847 |
| 848 // Context providers must be released prior to destroying the GPU channel. | 848 // Context providers must be released prior to destroying the GPU channel. |
| 849 shared_worker_context_provider_ = nullptr; |
| 849 gpu_va_context_provider_ = nullptr; | 850 gpu_va_context_provider_ = nullptr; |
| 850 shared_main_thread_contexts_ = nullptr; | 851 shared_main_thread_contexts_ = nullptr; |
| 851 | 852 |
| 852 if (gpu_channel_.get()) | 853 if (gpu_channel_.get()) |
| 853 gpu_channel_->DestroyChannel(); | 854 gpu_channel_->DestroyChannel(); |
| 854 | 855 |
| 855 // TODO(port) | 856 // TODO(port) |
| 856 #if defined(OS_WIN) | 857 #if defined(OS_WIN) |
| 857 // Clean up plugin channels before this thread goes away. | 858 // Clean up plugin channels before this thread goes away. |
| 858 NPChannelBase::CleanupChannels(); | 859 NPChannelBase::CleanupChannels(); |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 AddFilter(renderer_demuxer_.get()); | 1887 AddFilter(renderer_demuxer_.get()); |
| 1887 #endif | 1888 #endif |
| 1888 } | 1889 } |
| 1889 return media_thread_->task_runner(); | 1890 return media_thread_->task_runner(); |
| 1890 } | 1891 } |
| 1891 | 1892 |
| 1892 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { | 1893 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { |
| 1893 return raster_worker_pool_.get(); | 1894 return raster_worker_pool_.get(); |
| 1894 } | 1895 } |
| 1895 | 1896 |
| 1897 scoped_refptr<ContextProviderCommandBuffer> |
| 1898 RenderThreadImpl::SharedWorkerContextProvider() { |
| 1899 DCHECK(IsMainThread()); |
| 1900 // Try to reuse existing shared worker context provider. |
| 1901 bool shared_worker_context_provider_lost = false; |
| 1902 if (shared_worker_context_provider_) { |
| 1903 // Note: If context is lost, delete reference after releasing the lock. |
| 1904 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
| 1905 if (shared_worker_context_provider_->ContextGL() |
| 1906 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| 1907 shared_worker_context_provider_lost = true; |
| 1908 } |
| 1909 } |
| 1910 if (!shared_worker_context_provider_ || shared_worker_context_provider_lost) { |
| 1911 shared_worker_context_provider_ = ContextProviderCommandBuffer::Create( |
| 1912 CreateOffscreenContext3d(), RENDER_WORKER_CONTEXT); |
| 1913 if (shared_worker_context_provider_ && |
| 1914 !shared_worker_context_provider_->BindToCurrentThread()) |
| 1915 shared_worker_context_provider_ = nullptr; |
| 1916 if (shared_worker_context_provider_) |
| 1917 shared_worker_context_provider_->SetupLock(); |
| 1918 } |
| 1919 return shared_worker_context_provider_; |
| 1920 } |
| 1921 |
| 1896 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 1922 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
| 1897 blink_platform_impl_->sampleGamepads(*data); | 1923 blink_platform_impl_->sampleGamepads(*data); |
| 1898 } | 1924 } |
| 1899 | 1925 |
| 1900 bool RenderThreadImpl::RendererIsHidden() const { | 1926 bool RenderThreadImpl::RendererIsHidden() const { |
| 1901 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; | 1927 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; |
| 1902 } | 1928 } |
| 1903 | 1929 |
| 1904 void RenderThreadImpl::WidgetCreated() { | 1930 void RenderThreadImpl::WidgetCreated() { |
| 1905 bool renderer_was_hidden = RendererIsHidden(); | 1931 bool renderer_was_hidden = RendererIsHidden(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 } | 2004 } |
| 1979 | 2005 |
| 1980 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2006 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 1981 size_t erased = | 2007 size_t erased = |
| 1982 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2008 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 1983 routing_id_); | 2009 routing_id_); |
| 1984 DCHECK_EQ(1u, erased); | 2010 DCHECK_EQ(1u, erased); |
| 1985 } | 2011 } |
| 1986 | 2012 |
| 1987 } // namespace content | 2013 } // namespace content |
| OLD | NEW |