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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 | 1726 |
1727 // Some messages are handled by delegates. | 1727 // Some messages are handled by delegates. |
1728 if (appcache_dispatcher_->OnMessageReceived(msg) || | 1728 if (appcache_dispatcher_->OnMessageReceived(msg) || |
1729 dom_storage_dispatcher_->OnMessageReceived(msg) || | 1729 dom_storage_dispatcher_->OnMessageReceived(msg) || |
1730 embedded_worker_dispatcher_->OnMessageReceived(msg)) { | 1730 embedded_worker_dispatcher_->OnMessageReceived(msg)) { |
1731 return true; | 1731 return true; |
1732 } | 1732 } |
1733 | 1733 |
1734 bool handled = true; | 1734 bool handled = true; |
1735 IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg) | 1735 IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg) |
1736 IPC_MESSAGE_HANDLER(FrameMsg_NewFrame, OnCreateNewFrame) | |
1737 IPC_MESSAGE_HANDLER(FrameMsg_NewFrameProxy, OnCreateNewFrameProxy) | |
1738 // TODO(port): removed from render_messages_internal.h; | 1736 // TODO(port): removed from render_messages_internal.h; |
1739 // is there a new non-windows message I should add here? | 1737 // is there a new non-windows message I should add here? |
1740 IPC_MESSAGE_HANDLER(ViewMsg_NetworkConnectionChanged, | 1738 IPC_MESSAGE_HANDLER(ViewMsg_NetworkConnectionChanged, |
1741 OnNetworkConnectionChanged) | 1739 OnNetworkConnectionChanged) |
1742 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) | 1740 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) |
1743 #if defined(OS_ANDROID) | 1741 #if defined(OS_ANDROID) |
1744 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, | 1742 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, |
1745 OnSetWebKitSharedTimersSuspended) | 1743 OnSetWebKitSharedTimersSuspended) |
1746 #endif | 1744 #endif |
1747 #if defined(OS_MACOSX) | 1745 #if defined(OS_MACOSX) |
(...skipping 21 matching lines...) Expand all Loading... |
1769 | 1767 |
1770 void RenderThreadImpl::OnProcessPurgeAndSuspend() { | 1768 void RenderThreadImpl::OnProcessPurgeAndSuspend() { |
1771 ChildThreadImpl::OnProcessPurgeAndSuspend(); | 1769 ChildThreadImpl::OnProcessPurgeAndSuspend(); |
1772 if (is_renderer_suspended_) | 1770 if (is_renderer_suspended_) |
1773 return; | 1771 return; |
1774 // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077) | 1772 // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077) |
1775 is_renderer_suspended_ = true; | 1773 is_renderer_suspended_ = true; |
1776 renderer_scheduler_->SuspendRenderer(); | 1774 renderer_scheduler_->SuspendRenderer(); |
1777 } | 1775 } |
1778 | 1776 |
1779 void RenderThreadImpl::OnCreateNewFrame(FrameMsg_NewFrame_Params params) { | |
1780 // Debug cases of https://crbug.com/626802. | |
1781 base::debug::SetCrashKeyValue("newframe_routing_id", | |
1782 base::IntToString(params.routing_id)); | |
1783 base::debug::SetCrashKeyValue("newframe_proxy_id", | |
1784 base::IntToString(params.proxy_routing_id)); | |
1785 base::debug::SetCrashKeyValue("newframe_opener_id", | |
1786 base::IntToString(params.opener_routing_id)); | |
1787 base::debug::SetCrashKeyValue("newframe_parent_id", | |
1788 base::IntToString(params.parent_routing_id)); | |
1789 base::debug::SetCrashKeyValue("newframe_widget_id", | |
1790 base::IntToString( | |
1791 params.widget_params.routing_id)); | |
1792 base::debug::SetCrashKeyValue("newframe_widget_hidden", | |
1793 params.widget_params.hidden ? "yes" : "no"); | |
1794 base::debug::SetCrashKeyValue("newframe_replicated_origin", | |
1795 params.replication_state.origin.Serialize()); | |
1796 base::debug::SetCrashKeyValue("newframe_oopifs_possible", | |
1797 SiteIsolationPolicy::AreCrossProcessFramesPossible() ? "yes" : "no"); | |
1798 CompositorDependencies* compositor_deps = this; | |
1799 RenderFrameImpl::CreateFrame( | |
1800 params.routing_id, params.proxy_routing_id, params.opener_routing_id, | |
1801 params.parent_routing_id, params.previous_sibling_routing_id, | |
1802 params.replication_state, compositor_deps, params.widget_params, | |
1803 params.frame_owner_properties); | |
1804 } | |
1805 | |
1806 void RenderThreadImpl::OnCreateNewFrameProxy( | |
1807 int routing_id, | |
1808 int render_view_routing_id, | |
1809 int opener_routing_id, | |
1810 int parent_routing_id, | |
1811 const FrameReplicationState& replicated_state) { | |
1812 // Debug cases of https://crbug.com/575245. | |
1813 base::debug::SetCrashKeyValue("newproxy_proxy_id", | |
1814 base::IntToString(routing_id)); | |
1815 base::debug::SetCrashKeyValue("newproxy_view_id", | |
1816 base::IntToString(render_view_routing_id)); | |
1817 base::debug::SetCrashKeyValue("newproxy_opener_id", | |
1818 base::IntToString(opener_routing_id)); | |
1819 base::debug::SetCrashKeyValue("newproxy_parent_id", | |
1820 base::IntToString(parent_routing_id)); | |
1821 RenderFrameProxy::CreateFrameProxy(routing_id, render_view_routing_id, | |
1822 opener_routing_id, parent_routing_id, | |
1823 replicated_state); | |
1824 } | |
1825 | |
1826 scoped_refptr<gpu::GpuChannelHost> RenderThreadImpl::EstablishGpuChannelSync() { | 1777 scoped_refptr<gpu::GpuChannelHost> RenderThreadImpl::EstablishGpuChannelSync() { |
1827 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); | 1778 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); |
1828 | 1779 |
1829 if (gpu_channel_) { | 1780 if (gpu_channel_) { |
1830 // Do nothing if we already have a GPU channel or are already | 1781 // Do nothing if we already have a GPU channel or are already |
1831 // establishing one. | 1782 // establishing one. |
1832 if (!gpu_channel_->IsLost()) | 1783 if (!gpu_channel_->IsLost()) |
1833 return gpu_channel_; | 1784 return gpu_channel_; |
1834 | 1785 |
1835 // Recreate the channel if it has been lost. | 1786 // Recreate the channel if it has been lost. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 WebNetworkStateNotifier::setWebConnection( | 2021 WebNetworkStateNotifier::setWebConnection( |
2071 NetConnectionTypeToWebConnectionType(type), max_bandwidth_mbps); | 2022 NetConnectionTypeToWebConnectionType(type), max_bandwidth_mbps); |
2072 } | 2023 } |
2073 | 2024 |
2074 void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { | 2025 void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { |
2075 CompositorDependencies* compositor_deps = this; | 2026 CompositorDependencies* compositor_deps = this; |
2076 // When bringing in render_view, also bring in webkit's glue and jsbindings. | 2027 // When bringing in render_view, also bring in webkit's glue and jsbindings. |
2077 RenderViewImpl::Create(compositor_deps, *params, false); | 2028 RenderViewImpl::Create(compositor_deps, *params, false); |
2078 } | 2029 } |
2079 | 2030 |
| 2031 void RenderThreadImpl::CreateFrame(mojom::CreateFrameParamsPtr params) { |
| 2032 // Debug cases of https://crbug.com/626802. |
| 2033 base::debug::SetCrashKeyValue("newframe_routing_id", |
| 2034 base::IntToString(params->routing_id)); |
| 2035 base::debug::SetCrashKeyValue("newframe_proxy_id", |
| 2036 base::IntToString(params->proxy_routing_id)); |
| 2037 base::debug::SetCrashKeyValue("newframe_opener_id", |
| 2038 base::IntToString(params->opener_routing_id)); |
| 2039 base::debug::SetCrashKeyValue("newframe_parent_id", |
| 2040 base::IntToString(params->parent_routing_id)); |
| 2041 base::debug::SetCrashKeyValue("newframe_widget_id", |
| 2042 base::IntToString( |
| 2043 params->widget_params->routing_id)); |
| 2044 base::debug::SetCrashKeyValue("newframe_widget_hidden", |
| 2045 params->widget_params->hidden ? "yes" : "no"); |
| 2046 base::debug::SetCrashKeyValue("newframe_replicated_origin", |
| 2047 params->replication_state.origin.Serialize()); |
| 2048 base::debug::SetCrashKeyValue("newframe_oopifs_possible", |
| 2049 SiteIsolationPolicy::AreCrossProcessFramesPossible() ? "yes" : "no"); |
| 2050 CompositorDependencies* compositor_deps = this; |
| 2051 RenderFrameImpl::CreateFrame( |
| 2052 params->routing_id, params->proxy_routing_id, params->opener_routing_id, |
| 2053 params->parent_routing_id, params->previous_sibling_routing_id, |
| 2054 params->replication_state, compositor_deps, *params->widget_params, |
| 2055 params->frame_owner_properties); |
| 2056 } |
| 2057 |
| 2058 void RenderThreadImpl::CreateFrameProxy( |
| 2059 int32_t routing_id, |
| 2060 int32_t render_view_routing_id, |
| 2061 int32_t opener_routing_id, |
| 2062 int32_t parent_routing_id, |
| 2063 const FrameReplicationState& replicated_state) { |
| 2064 // Debug cases of https://crbug.com/575245. |
| 2065 base::debug::SetCrashKeyValue("newproxy_proxy_id", |
| 2066 base::IntToString(routing_id)); |
| 2067 base::debug::SetCrashKeyValue("newproxy_view_id", |
| 2068 base::IntToString(render_view_routing_id)); |
| 2069 base::debug::SetCrashKeyValue("newproxy_opener_id", |
| 2070 base::IntToString(opener_routing_id)); |
| 2071 base::debug::SetCrashKeyValue("newproxy_parent_id", |
| 2072 base::IntToString(parent_routing_id)); |
| 2073 RenderFrameProxy::CreateFrameProxy(routing_id, render_view_routing_id, |
| 2074 opener_routing_id, parent_routing_id, |
| 2075 replicated_state); |
| 2076 } |
| 2077 |
2080 void RenderThreadImpl::OnTimeZoneChange(const std::string& zone_id) { | 2078 void RenderThreadImpl::OnTimeZoneChange(const std::string& zone_id) { |
2081 if (!blink_platform_impl_) | 2079 if (!blink_platform_impl_) |
2082 return; | 2080 return; |
2083 if (!zone_id.empty()) { | 2081 if (!zone_id.empty()) { |
2084 icu::TimeZone *new_zone = icu::TimeZone::createTimeZone( | 2082 icu::TimeZone *new_zone = icu::TimeZone::createTimeZone( |
2085 icu::UnicodeString::fromUTF8(zone_id)); | 2083 icu::UnicodeString::fromUTF8(zone_id)); |
2086 icu::TimeZone::adoptDefault(new_zone); | 2084 icu::TimeZone::adoptDefault(new_zone); |
2087 VLOG(1) << "ICU default timezone is set to " << zone_id; | 2085 VLOG(1) << "ICU default timezone is set to " << zone_id; |
2088 } | 2086 } |
2089 NotifyTimezoneChange(); | 2087 NotifyTimezoneChange(); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 } | 2329 } |
2332 } | 2330 } |
2333 | 2331 |
2334 void RenderThreadImpl::OnRendererInterfaceRequest( | 2332 void RenderThreadImpl::OnRendererInterfaceRequest( |
2335 mojom::RendererAssociatedRequest request) { | 2333 mojom::RendererAssociatedRequest request) { |
2336 DCHECK(!renderer_binding_.is_bound()); | 2334 DCHECK(!renderer_binding_.is_bound()); |
2337 renderer_binding_.Bind(std::move(request)); | 2335 renderer_binding_.Bind(std::move(request)); |
2338 } | 2336 } |
2339 | 2337 |
2340 } // namespace content | 2338 } // namespace content |
OLD | NEW |