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; |
848 gpu_va_context_provider_ = nullptr; | 849 gpu_va_context_provider_ = nullptr; |
849 shared_main_thread_contexts_ = nullptr; | 850 shared_main_thread_contexts_ = nullptr; |
850 | 851 |
851 if (gpu_channel_.get()) | 852 if (gpu_channel_.get()) |
852 gpu_channel_->DestroyChannel(); | 853 gpu_channel_->DestroyChannel(); |
853 | 854 |
854 // TODO(port) | 855 // TODO(port) |
855 #if defined(OS_WIN) | 856 #if defined(OS_WIN) |
856 // Clean up plugin channels before this thread goes away. | 857 // Clean up plugin channels before this thread goes away. |
857 NPChannelBase::CleanupChannels(); | 858 NPChannelBase::CleanupChannels(); |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 AddFilter(renderer_demuxer_.get()); | 1882 AddFilter(renderer_demuxer_.get()); |
1882 #endif | 1883 #endif |
1883 } | 1884 } |
1884 return media_thread_->task_runner(); | 1885 return media_thread_->task_runner(); |
1885 } | 1886 } |
1886 | 1887 |
1887 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { | 1888 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { |
1888 return raster_worker_pool_.get(); | 1889 return raster_worker_pool_.get(); |
1889 } | 1890 } |
1890 | 1891 |
| 1892 scoped_refptr<ContextProviderCommandBuffer> |
| 1893 RenderThreadImpl::SharedWorkerContextProvider() { |
| 1894 DCHECK(IsMainThread()); |
| 1895 // Try to reuse existing shared worker context provider. |
| 1896 bool shared_worker_context_provider_lost = false; |
| 1897 if (shared_worker_context_provider_) { |
| 1898 base::AutoLock lock(*shared_worker_context_provider_->GetLock()); |
| 1899 if (shared_worker_context_provider_->ContextGL() |
| 1900 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| 1901 shared_worker_context_provider_lost = true; |
| 1902 } |
| 1903 } |
| 1904 if (!shared_worker_context_provider_ || shared_worker_context_provider_lost) { |
| 1905 shared_worker_context_provider_ = ContextProviderCommandBuffer::Create( |
| 1906 CreateOffscreenContext3d(), RENDER_WORKER_CONTEXT); |
| 1907 if (shared_worker_context_provider_ && |
| 1908 !shared_worker_context_provider_->BindToCurrentThread()) |
| 1909 shared_worker_context_provider_ = nullptr; |
| 1910 if (shared_worker_context_provider_) |
| 1911 shared_worker_context_provider_->SetupLock(); |
| 1912 } |
| 1913 return shared_worker_context_provider_; |
| 1914 } |
| 1915 |
1891 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 1916 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
1892 blink_platform_impl_->sampleGamepads(*data); | 1917 blink_platform_impl_->sampleGamepads(*data); |
1893 } | 1918 } |
1894 | 1919 |
1895 bool RenderThreadImpl::RendererIsHidden() const { | 1920 bool RenderThreadImpl::RendererIsHidden() const { |
1896 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; | 1921 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; |
1897 } | 1922 } |
1898 | 1923 |
1899 void RenderThreadImpl::WidgetCreated() { | 1924 void RenderThreadImpl::WidgetCreated() { |
1900 bool renderer_was_hidden = RendererIsHidden(); | 1925 bool renderer_was_hidden = RendererIsHidden(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1973 } | 1998 } |
1974 | 1999 |
1975 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2000 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
1976 size_t erased = | 2001 size_t erased = |
1977 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2002 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
1978 routing_id_); | 2003 routing_id_); |
1979 DCHECK_EQ(1u, erased); | 2004 DCHECK_EQ(1u, erased); |
1980 } | 2005 } |
1981 | 2006 |
1982 } // namespace content | 2007 } // namespace content |
OLD | NEW |