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

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

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add in_process context support Created 5 years, 3 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
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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 AddFilter(renderer_demuxer_.get()); 1885 AddFilter(renderer_demuxer_.get());
1885 #endif 1886 #endif
1886 } 1887 }
1887 return media_thread_->task_runner(); 1888 return media_thread_->task_runner();
1888 } 1889 }
1889 1890
1890 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() { 1891 base::TaskRunner* RenderThreadImpl::GetWorkerTaskRunner() {
1891 return raster_worker_pool_.get(); 1892 return raster_worker_pool_.get();
1892 } 1893 }
1893 1894
1895 scoped_refptr<ContextProviderCommandBuffer>
1896 RenderThreadImpl::SharedWorkerContextProvider() {
1897 DCHECK(IsMainThread());
1898 // Try to reuse existing shared worker context provider.
1899 bool shared_worker_context_provider_lost = false;
1900 if (shared_worker_context_provider_) {
1901 // Note: If context is lost, delete reference after releasing the lock.
1902 base::AutoLock lock(*shared_worker_context_provider_->GetLock());
1903 if (shared_worker_context_provider_->ContextGL()
1904 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
1905 shared_worker_context_provider_lost = true;
1906 }
1907 }
1908 if (!shared_worker_context_provider_ || shared_worker_context_provider_lost) {
1909 shared_worker_context_provider_ = ContextProviderCommandBuffer::Create(
1910 CreateOffscreenContext3d(), RENDER_WORKER_CONTEXT);
1911 if (shared_worker_context_provider_ &&
1912 !shared_worker_context_provider_->BindToCurrentThread())
1913 shared_worker_context_provider_ = nullptr;
1914 if (shared_worker_context_provider_)
1915 shared_worker_context_provider_->SetupLock();
1916 }
1917 return shared_worker_context_provider_;
1918 }
1919
1894 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { 1920 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) {
1895 blink_platform_impl_->sampleGamepads(*data); 1921 blink_platform_impl_->sampleGamepads(*data);
1896 } 1922 }
1897 1923
1898 bool RenderThreadImpl::RendererIsHidden() const { 1924 bool RenderThreadImpl::RendererIsHidden() const {
1899 return widget_count_ > 0 && hidden_widget_count_ == widget_count_; 1925 return widget_count_ > 0 && hidden_widget_count_ == widget_count_;
1900 } 1926 }
1901 1927
1902 void RenderThreadImpl::WidgetCreated() { 1928 void RenderThreadImpl::WidgetCreated() {
1903 bool renderer_was_hidden = RendererIsHidden(); 1929 bool renderer_was_hidden = RendererIsHidden();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1976 } 2002 }
1977 2003
1978 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { 2004 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() {
1979 size_t erased = 2005 size_t erased =
1980 RenderThreadImpl::current()->pending_render_frame_connects_.erase( 2006 RenderThreadImpl::current()->pending_render_frame_connects_.erase(
1981 routing_id_); 2007 routing_id_);
1982 DCHECK_EQ(1u, erased); 2008 DCHECK_EQ(1u, erased);
1983 } 2009 }
1984 2010
1985 } // namespace content 2011 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698