Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 #include "content/common/content_constants_internal.h" | 46 #include "content/common/content_constants_internal.h" |
| 47 #include "content/common/database_messages.h" | 47 #include "content/common/database_messages.h" |
| 48 #include "content/common/dom_storage/dom_storage_messages.h" | 48 #include "content/common/dom_storage/dom_storage_messages.h" |
| 49 #include "content/common/gpu/client/context_provider_command_buffer.h" | 49 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 50 #include "content/common/gpu/client/gpu_channel_host.h" | 50 #include "content/common/gpu/client/gpu_channel_host.h" |
| 51 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 51 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 52 #include "content/common/gpu/gpu_messages.h" | 52 #include "content/common/gpu/gpu_messages.h" |
| 53 #include "content/common/gpu/gpu_process_launch_causes.h" | 53 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 54 #include "content/common/resource_messages.h" | 54 #include "content/common/resource_messages.h" |
| 55 #include "content/common/view_messages.h" | 55 #include "content/common/view_messages.h" |
| 56 #include "content/common/worker_messages.h" | |
| 56 #include "content/public/common/content_constants.h" | 57 #include "content/public/common/content_constants.h" |
| 57 #include "content/public/common/content_paths.h" | 58 #include "content/public/common/content_paths.h" |
| 58 #include "content/public/common/content_switches.h" | 59 #include "content/public/common/content_switches.h" |
| 59 #include "content/public/common/renderer_preferences.h" | 60 #include "content/public/common/renderer_preferences.h" |
| 60 #include "content/public/common/url_constants.h" | 61 #include "content/public/common/url_constants.h" |
| 61 #include "content/public/renderer/content_renderer_client.h" | 62 #include "content/public/renderer/content_renderer_client.h" |
| 62 #include "content/public/renderer/render_process_observer.h" | 63 #include "content/public/renderer/render_process_observer.h" |
| 63 #include "content/public/renderer/render_view_visitor.h" | 64 #include "content/public/renderer/render_view_visitor.h" |
| 64 #include "content/renderer/devtools/devtools_agent_filter.h" | 65 #include "content/renderer/devtools/devtools_agent_filter.h" |
| 65 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" | 66 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 80 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" | 81 #include "content/renderer/media/renderer_gpu_video_accelerator_factories.h" |
| 81 #include "content/renderer/media/video_capture_impl_manager.h" | 82 #include "content/renderer/media/video_capture_impl_manager.h" |
| 82 #include "content/renderer/media/video_capture_message_filter.h" | 83 #include "content/renderer/media/video_capture_message_filter.h" |
| 83 #include "content/renderer/media/webrtc_identity_service.h" | 84 #include "content/renderer/media/webrtc_identity_service.h" |
| 84 #include "content/renderer/p2p/socket_dispatcher.h" | 85 #include "content/renderer/p2p/socket_dispatcher.h" |
| 85 #include "content/renderer/render_process_impl.h" | 86 #include "content/renderer/render_process_impl.h" |
| 86 #include "content/renderer/render_view_impl.h" | 87 #include "content/renderer/render_view_impl.h" |
| 87 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 88 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 88 #include "content/renderer/service_worker/embedded_worker_context_message_filter .h" | 89 #include "content/renderer/service_worker/embedded_worker_context_message_filter .h" |
| 89 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" | 90 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
| 91 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" | |
| 90 #include "grit/content_resources.h" | 92 #include "grit/content_resources.h" |
| 91 #include "ipc/ipc_channel_handle.h" | 93 #include "ipc/ipc_channel_handle.h" |
| 92 #include "ipc/ipc_forwarding_message_filter.h" | 94 #include "ipc/ipc_forwarding_message_filter.h" |
| 93 #include "ipc/ipc_platform_file.h" | 95 #include "ipc/ipc_platform_file.h" |
| 94 #include "media/base/audio_hardware_config.h" | 96 #include "media/base/audio_hardware_config.h" |
| 95 #include "media/base/media.h" | 97 #include "media/base/media.h" |
| 96 #include "media/filters/gpu_video_accelerator_factories.h" | 98 #include "media/filters/gpu_video_accelerator_factories.h" |
| 97 #include "net/base/net_errors.h" | 99 #include "net/base/net_errors.h" |
| 98 #include "net/base/net_util.h" | 100 #include "net/base/net_util.h" |
| 99 #include "skia/ext/event_tracer_impl.h" | 101 #include "skia/ext/event_tracer_impl.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 return ChildProcess::current()->io_message_loop_proxy(); | 617 return ChildProcess::current()->io_message_loop_proxy(); |
| 616 } | 618 } |
| 617 | 619 |
| 618 void RenderThreadImpl::AddRoute(int32 routing_id, IPC::Listener* listener) { | 620 void RenderThreadImpl::AddRoute(int32 routing_id, IPC::Listener* listener) { |
| 619 ChildThread::AddRoute(routing_id, listener); | 621 ChildThread::AddRoute(routing_id, listener); |
| 620 } | 622 } |
| 621 | 623 |
| 622 void RenderThreadImpl::RemoveRoute(int32 routing_id) { | 624 void RenderThreadImpl::RemoveRoute(int32 routing_id) { |
| 623 ChildThread::RemoveRoute(routing_id); | 625 ChildThread::RemoveRoute(routing_id); |
| 624 } | 626 } |
| 627 | |
| 625 int RenderThreadImpl::GenerateRoutingID() { | 628 int RenderThreadImpl::GenerateRoutingID() { |
| 626 int routing_id = MSG_ROUTING_NONE; | 629 int routing_id = MSG_ROUTING_NONE; |
| 627 Send(new ViewHostMsg_GenerateRoutingID(&routing_id)); | 630 Send(new ViewHostMsg_GenerateRoutingID(&routing_id)); |
| 628 return routing_id; | 631 return routing_id; |
| 629 } | 632 } |
| 630 | 633 |
| 631 void RenderThreadImpl::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { | 634 void RenderThreadImpl::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { |
| 632 channel()->AddFilter(filter); | 635 channel()->AddFilter(filter); |
| 633 } | 636 } |
| 634 | 637 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1163 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) | 1166 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) |
| 1164 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) | 1167 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) |
| 1165 IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) | 1168 IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) |
| 1166 #if defined(OS_ANDROID) | 1169 #if defined(OS_ANDROID) |
| 1167 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, | 1170 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, |
| 1168 OnSetWebKitSharedTimersSuspended) | 1171 OnSetWebKitSharedTimersSuspended) |
| 1169 #endif | 1172 #endif |
| 1170 #if defined(OS_MACOSX) | 1173 #if defined(OS_MACOSX) |
| 1171 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme) | 1174 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme) |
| 1172 #endif | 1175 #endif |
| 1176 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) | |
|
kinuko
2014/03/11 07:48:17
nit: it might be slightly easier to read to put th
horo
2014/03/11 07:55:57
Done.
| |
| 1173 IPC_MESSAGE_UNHANDLED(handled = false) | 1177 IPC_MESSAGE_UNHANDLED(handled = false) |
| 1174 IPC_END_MESSAGE_MAP() | 1178 IPC_END_MESSAGE_MAP() |
| 1175 return handled; | 1179 return handled; |
| 1176 } | 1180 } |
| 1177 | 1181 |
| 1178 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { | 1182 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { |
| 1179 EnsureWebKitInitialized(); | 1183 EnsureWebKitInitialized(); |
| 1180 // When bringing in render_view, also bring in webkit's glue and jsbindings. | 1184 // When bringing in render_view, also bring in webkit's glue and jsbindings. |
| 1181 RenderViewImpl::Create(params.opener_route_id, | 1185 RenderViewImpl::Create(params.opener_route_id, |
| 1182 params.renderer_preferences, | 1186 params.renderer_preferences, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1322 static_cast<WebScrollbarBehaviorImpl*>( | 1326 static_cast<WebScrollbarBehaviorImpl*>( |
| 1323 webkit_platform_support_->scrollbarBehavior())->set_jump_on_track_click( | 1327 webkit_platform_support_->scrollbarBehavior())->set_jump_on_track_click( |
| 1324 jump_on_track_click); | 1328 jump_on_track_click); |
| 1325 blink::WebScrollbarTheme::updateScrollbars(initial_button_delay, | 1329 blink::WebScrollbarTheme::updateScrollbars(initial_button_delay, |
| 1326 autoscroll_button_delay, | 1330 autoscroll_button_delay, |
| 1327 preferred_scroller_style, | 1331 preferred_scroller_style, |
| 1328 redraw); | 1332 redraw); |
| 1329 } | 1333 } |
| 1330 #endif | 1334 #endif |
| 1331 | 1335 |
| 1336 void RenderThreadImpl::OnCreateNewSharedWorker( | |
| 1337 const WorkerProcessMsg_CreateWorker_Params& params) { | |
| 1338 new EmbeddedSharedWorkerStub(params.url, | |
|
kinuko
2014/03/11 07:48:17
Adds a brief comment that this class's self-destru
horo
2014/03/11 07:55:57
Done.
| |
| 1339 params.name, | |
| 1340 params.content_security_policy, | |
| 1341 params.security_policy_type, | |
| 1342 params.route_id); | |
| 1343 } | |
| 1344 | |
| 1332 void RenderThreadImpl::OnMemoryPressure( | 1345 void RenderThreadImpl::OnMemoryPressure( |
| 1333 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { | 1346 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { |
| 1334 base::allocator::ReleaseFreeMemory(); | 1347 base::allocator::ReleaseFreeMemory(); |
| 1335 | 1348 |
| 1336 if (memory_pressure_level == | 1349 if (memory_pressure_level == |
| 1337 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { | 1350 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { |
| 1338 // Trigger full v8 garbage collection on critical memory notification. | 1351 // Trigger full v8 garbage collection on critical memory notification. |
| 1339 v8::V8::LowMemoryNotification(); | 1352 v8::V8::LowMemoryNotification(); |
| 1340 // Clear the image cache. | 1353 // Clear the image cache. |
| 1341 blink::WebImageCache::clear(); | 1354 blink::WebImageCache::clear(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1418 hidden_widget_count_--; | 1431 hidden_widget_count_--; |
| 1419 | 1432 |
| 1420 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1433 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1421 return; | 1434 return; |
| 1422 } | 1435 } |
| 1423 | 1436 |
| 1424 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1437 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1425 } | 1438 } |
| 1426 | 1439 |
| 1427 } // namespace content | 1440 } // namespace content |
| OLD | NEW |