| 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 897 |
| 898 is_renderer_suspended_ = false; | 898 is_renderer_suspended_ = false; |
| 899 | 899 |
| 900 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); | 900 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); |
| 901 } | 901 } |
| 902 | 902 |
| 903 RenderThreadImpl::~RenderThreadImpl() { | 903 RenderThreadImpl::~RenderThreadImpl() { |
| 904 } | 904 } |
| 905 | 905 |
| 906 void RenderThreadImpl::Shutdown() { | 906 void RenderThreadImpl::Shutdown() { |
| 907 FOR_EACH_OBSERVER( | 907 for (auto& observer : observers_) |
| 908 RenderThreadObserver, observers_, OnRenderProcessShutdown()); | 908 observer.OnRenderProcessShutdown(); |
| 909 | 909 |
| 910 if (memory_observer_) { | 910 if (memory_observer_) { |
| 911 message_loop()->RemoveTaskObserver(memory_observer_.get()); | 911 message_loop()->RemoveTaskObserver(memory_observer_.get()); |
| 912 memory_observer_.reset(); | 912 memory_observer_.reset(); |
| 913 } | 913 } |
| 914 | 914 |
| 915 // Wait for all databases to be closed. | 915 // Wait for all databases to be closed. |
| 916 if (blink_platform_impl_) { | 916 if (blink_platform_impl_) { |
| 917 // Crash the process if they fail to close after a generous amount of time. | 917 // Crash the process if they fail to close after a generous amount of time. |
| 918 bool all_closed = blink_platform_impl_->web_database_observer_impl() | 918 bool all_closed = blink_platform_impl_->web_database_observer_impl() |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 if (continue_timer) { | 1410 if (continue_timer) { |
| 1411 ScheduleIdleHandler( | 1411 ScheduleIdleHandler( |
| 1412 std::max(kLongIdleHandlerDelayMs, | 1412 std::max(kLongIdleHandlerDelayMs, |
| 1413 idle_notification_delay_in_ms_ + | 1413 idle_notification_delay_in_ms_ + |
| 1414 1000000 / (idle_notification_delay_in_ms_ + 2000))); | 1414 1000000 / (idle_notification_delay_in_ms_ + 2000))); |
| 1415 | 1415 |
| 1416 } else { | 1416 } else { |
| 1417 idle_timer_.Stop(); | 1417 idle_timer_.Stop(); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 FOR_EACH_OBSERVER(RenderThreadObserver, observers_, IdleNotification()); | 1420 for (auto& observer : observers_) |
| 1421 observer.IdleNotification(); |
| 1421 } | 1422 } |
| 1422 | 1423 |
| 1423 int64_t RenderThreadImpl::GetIdleNotificationDelayInMs() const { | 1424 int64_t RenderThreadImpl::GetIdleNotificationDelayInMs() const { |
| 1424 return idle_notification_delay_in_ms_; | 1425 return idle_notification_delay_in_ms_; |
| 1425 } | 1426 } |
| 1426 | 1427 |
| 1427 void RenderThreadImpl::SetIdleNotificationDelayInMs( | 1428 void RenderThreadImpl::SetIdleNotificationDelayInMs( |
| 1428 int64_t idle_notification_delay_in_ms) { | 1429 int64_t idle_notification_delay_in_ms) { |
| 1429 idle_notification_delay_in_ms_ = idle_notification_delay_in_ms; | 1430 idle_notification_delay_in_ms_ = idle_notification_delay_in_ms; |
| 1430 } | 1431 } |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 #if defined(ENABLE_PLUGINS) | 2001 #if defined(ENABLE_PLUGINS) |
| 2001 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { | 2002 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { |
| 2002 // The call below will cause a GetPlugins call with refresh=true, but at this | 2003 // The call below will cause a GetPlugins call with refresh=true, but at this |
| 2003 // point we already know that the browser has refreshed its list, so disable | 2004 // point we already know that the browser has refreshed its list, so disable |
| 2004 // refresh temporarily to prevent each renderer process causing the list to be | 2005 // refresh temporarily to prevent each renderer process causing the list to be |
| 2005 // regenerated. | 2006 // regenerated. |
| 2006 blink_platform_impl_->set_plugin_refresh_allowed(false); | 2007 blink_platform_impl_->set_plugin_refresh_allowed(false); |
| 2007 blink::resetPluginCache(reload_pages); | 2008 blink::resetPluginCache(reload_pages); |
| 2008 blink_platform_impl_->set_plugin_refresh_allowed(true); | 2009 blink_platform_impl_->set_plugin_refresh_allowed(true); |
| 2009 | 2010 |
| 2010 FOR_EACH_OBSERVER(RenderThreadObserver, observers_, PluginListChanged()); | 2011 for (auto& observer : observers_) |
| 2012 observer.PluginListChanged(); |
| 2011 } | 2013 } |
| 2012 #endif | 2014 #endif |
| 2013 | 2015 |
| 2014 void RenderThreadImpl::OnNetworkConnectionChanged( | 2016 void RenderThreadImpl::OnNetworkConnectionChanged( |
| 2015 net::NetworkChangeNotifier::ConnectionType type, | 2017 net::NetworkChangeNotifier::ConnectionType type, |
| 2016 double max_bandwidth_mbps) { | 2018 double max_bandwidth_mbps) { |
| 2017 bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; | 2019 bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; |
| 2018 WebNetworkStateNotifier::setOnLine(online); | 2020 WebNetworkStateNotifier::setOnLine(online); |
| 2019 FOR_EACH_OBSERVER( | 2021 for (auto& observer : observers_) |
| 2020 RenderThreadObserver, observers_, NetworkStateChanged(online)); | 2022 observer.NetworkStateChanged(online); |
| 2021 WebNetworkStateNotifier::setWebConnection( | 2023 WebNetworkStateNotifier::setWebConnection( |
| 2022 NetConnectionTypeToWebConnectionType(type), max_bandwidth_mbps); | 2024 NetConnectionTypeToWebConnectionType(type), max_bandwidth_mbps); |
| 2023 } | 2025 } |
| 2024 | 2026 |
| 2025 void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { | 2027 void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { |
| 2026 CompositorDependencies* compositor_deps = this; | 2028 CompositorDependencies* compositor_deps = this; |
| 2027 // When bringing in render_view, also bring in webkit's glue and jsbindings. | 2029 // When bringing in render_view, also bring in webkit's glue and jsbindings. |
| 2028 RenderViewImpl::Create(compositor_deps, *params, false); | 2030 RenderViewImpl::Create(compositor_deps, *params, false); |
| 2029 } | 2031 } |
| 2030 | 2032 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 } | 2359 } |
| 2358 } | 2360 } |
| 2359 | 2361 |
| 2360 void RenderThreadImpl::OnRendererInterfaceRequest( | 2362 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2361 mojom::RendererAssociatedRequest request) { | 2363 mojom::RendererAssociatedRequest request) { |
| 2362 DCHECK(!renderer_binding_.is_bound()); | 2364 DCHECK(!renderer_binding_.is_bound()); |
| 2363 renderer_binding_.Bind(std::move(request)); | 2365 renderer_binding_.Bind(std::move(request)); |
| 2364 } | 2366 } |
| 2365 | 2367 |
| 2366 } // namespace content | 2368 } // namespace content |
| OLD | NEW |