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