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 <utility> | 10 #include <utility> |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 | 1437 |
1438 scoped_refptr<ContextProviderCommandBuffer> | 1438 scoped_refptr<ContextProviderCommandBuffer> |
1439 RenderThreadImpl::SharedMainThreadContextProvider() { | 1439 RenderThreadImpl::SharedMainThreadContextProvider() { |
1440 DCHECK(IsMainThread()); | 1440 DCHECK(IsMainThread()); |
1441 if (shared_main_thread_contexts_ && | 1441 if (shared_main_thread_contexts_ && |
1442 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() == | 1442 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() == |
1443 GL_NO_ERROR) | 1443 GL_NO_ERROR) |
1444 return shared_main_thread_contexts_; | 1444 return shared_main_thread_contexts_; |
1445 | 1445 |
1446 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1446 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
1447 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1447 CAUSE_FOR_GPU_LAUNCH_RENDERER_SHARED_MAIN_THREAD_CONTEXT)); |
1448 if (!gpu_channel_host) { | 1448 if (!gpu_channel_host) { |
1449 shared_main_thread_contexts_ = nullptr; | 1449 shared_main_thread_contexts_ = nullptr; |
1450 return nullptr; | 1450 return nullptr; |
1451 } | 1451 } |
1452 | 1452 |
1453 shared_main_thread_contexts_ = CreateOffscreenContext( | 1453 shared_main_thread_contexts_ = CreateOffscreenContext( |
1454 std::move(gpu_channel_host), | 1454 std::move(gpu_channel_host), |
1455 command_buffer_metrics::RENDERER_MAINTHREAD_CONTEXT); | 1455 command_buffer_metrics::RENDERER_MAINTHREAD_CONTEXT); |
1456 if (!shared_main_thread_contexts_->BindToCurrentThread()) | 1456 if (!shared_main_thread_contexts_->BindToCurrentThread()) |
1457 shared_main_thread_contexts_ = nullptr; | 1457 shared_main_thread_contexts_ = nullptr; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 | 1784 |
1785 #if defined(ENABLE_WEBRTC) | 1785 #if defined(ENABLE_WEBRTC) |
1786 PeerConnectionDependencyFactory* | 1786 PeerConnectionDependencyFactory* |
1787 RenderThreadImpl::GetPeerConnectionDependencyFactory() { | 1787 RenderThreadImpl::GetPeerConnectionDependencyFactory() { |
1788 return peer_connection_factory_.get(); | 1788 return peer_connection_factory_.get(); |
1789 } | 1789 } |
1790 #endif | 1790 #endif |
1791 | 1791 |
1792 gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() { | 1792 gpu::GpuChannelHost* RenderThreadImpl::GetGpuChannel() { |
1793 if (!gpu_channel_) | 1793 if (!gpu_channel_) |
1794 return NULL; | 1794 return nullptr; |
1795 | |
1796 if (gpu_channel_->IsLost()) | 1795 if (gpu_channel_->IsLost()) |
1797 return NULL; | 1796 return nullptr; |
1798 | |
1799 return gpu_channel_.get(); | 1797 return gpu_channel_.get(); |
1800 } | 1798 } |
1801 | 1799 |
1802 #if defined(ENABLE_PLUGINS) | 1800 #if defined(ENABLE_PLUGINS) |
1803 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { | 1801 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { |
1804 // The call below will cause a GetPlugins call with refresh=true, but at this | 1802 // The call below will cause a GetPlugins call with refresh=true, but at this |
1805 // point we already know that the browser has refreshed its list, so disable | 1803 // point we already know that the browser has refreshed its list, so disable |
1806 // refresh temporarily to prevent each renderer process causing the list to be | 1804 // refresh temporarily to prevent each renderer process causing the list to be |
1807 // regenerated. | 1805 // regenerated. |
1808 blink_platform_impl_->set_plugin_refresh_allowed(false); | 1806 blink_platform_impl_->set_plugin_refresh_allowed(false); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 if (shared_worker_context_provider_) { | 1932 if (shared_worker_context_provider_) { |
1935 // Note: If context is lost, delete reference after releasing the lock. | 1933 // Note: If context is lost, delete reference after releasing the lock. |
1936 cc::ContextProvider::ScopedContextLock lock( | 1934 cc::ContextProvider::ScopedContextLock lock( |
1937 shared_worker_context_provider_.get()); | 1935 shared_worker_context_provider_.get()); |
1938 if (shared_worker_context_provider_->ContextGL() | 1936 if (shared_worker_context_provider_->ContextGL() |
1939 ->GetGraphicsResetStatusKHR() == GL_NO_ERROR) | 1937 ->GetGraphicsResetStatusKHR() == GL_NO_ERROR) |
1940 return shared_worker_context_provider_; | 1938 return shared_worker_context_provider_; |
1941 } | 1939 } |
1942 | 1940 |
1943 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1941 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
1944 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1942 CAUSE_FOR_GPU_LAUNCH_SHARED_WORKER_THREAD_CONTEXT)); |
1945 if (!gpu_channel_host) { | 1943 if (!gpu_channel_host) { |
1946 shared_worker_context_provider_ = nullptr; | 1944 shared_worker_context_provider_ = nullptr; |
1947 return shared_worker_context_provider_; | 1945 return shared_worker_context_provider_; |
1948 } | 1946 } |
1949 | 1947 |
1950 shared_worker_context_provider_ = | 1948 shared_worker_context_provider_ = |
1951 CreateOffscreenContext(std::move(gpu_channel_host), | 1949 CreateOffscreenContext(std::move(gpu_channel_host), |
1952 command_buffer_metrics::RENDER_WORKER_CONTEXT); | 1950 command_buffer_metrics::RENDER_WORKER_CONTEXT); |
1953 if (!shared_worker_context_provider_->BindToCurrentThread()) | 1951 if (!shared_worker_context_provider_->BindToCurrentThread()) |
1954 shared_worker_context_provider_ = nullptr; | 1952 shared_worker_context_provider_ = nullptr; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2059 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
2062 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2060 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
2063 | 2061 |
2064 blink::mainThreadIsolate()->MemoryPressureNotification( | 2062 blink::mainThreadIsolate()->MemoryPressureNotification( |
2065 v8_memory_pressure_level); | 2063 v8_memory_pressure_level); |
2066 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2064 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2067 v8_memory_pressure_level); | 2065 v8_memory_pressure_level); |
2068 } | 2066 } |
2069 | 2067 |
2070 } // namespace content | 2068 } // namespace content |
OLD | NEW |