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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1327 | 1327 |
1328 bool handled = true; | 1328 bool handled = true; |
1329 IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg) | 1329 IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg) |
1330 IPC_MESSAGE_HANDLER(FrameMsg_NewFrame, OnCreateNewFrame) | 1330 IPC_MESSAGE_HANDLER(FrameMsg_NewFrame, OnCreateNewFrame) |
1331 IPC_MESSAGE_HANDLER(FrameMsg_NewFrameProxy, OnCreateNewFrameProxy) | 1331 IPC_MESSAGE_HANDLER(FrameMsg_NewFrameProxy, OnCreateNewFrameProxy) |
1332 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL, | 1332 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL, |
1333 OnSetZoomLevelForCurrentURL) | 1333 OnSetZoomLevelForCurrentURL) |
1334 // TODO(port): removed from render_messages_internal.h; | 1334 // TODO(port): removed from render_messages_internal.h; |
1335 // is there a new non-windows message I should add here? | 1335 // is there a new non-windows message I should add here? |
1336 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) | 1336 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) |
1337 #if defined(ENABLE_PLUGINS) | |
jam
2014/09/03 17:37:05
nit: put the ifdefs at the end of this block, i.e.
Lei Zhang
2014/09/04 00:30:24
Done.
| |
1337 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) | 1338 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) |
1339 #endif | |
1338 IPC_MESSAGE_HANDLER(ViewMsg_NetworkTypeChanged, OnNetworkTypeChanged) | 1340 IPC_MESSAGE_HANDLER(ViewMsg_NetworkTypeChanged, OnNetworkTypeChanged) |
1339 IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) | 1341 IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) |
1340 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) | 1342 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateNewSharedWorker) |
1341 IPC_MESSAGE_HANDLER(ViewMsg_TimezoneChange, OnUpdateTimezone) | 1343 IPC_MESSAGE_HANDLER(ViewMsg_TimezoneChange, OnUpdateTimezone) |
1342 #if defined(OS_ANDROID) | 1344 #if defined(OS_ANDROID) |
1343 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, | 1345 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, |
1344 OnSetWebKitSharedTimersSuspended) | 1346 OnSetWebKitSharedTimersSuspended) |
1345 #endif | 1347 #endif |
1346 #if defined(OS_MACOSX) | 1348 #if defined(OS_MACOSX) |
1347 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme) | 1349 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScrollbarTheme, OnUpdateScrollbarTheme) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1465 GpuChannelHost* RenderThreadImpl::GetGpuChannel() { | 1467 GpuChannelHost* RenderThreadImpl::GetGpuChannel() { |
1466 if (!gpu_channel_.get()) | 1468 if (!gpu_channel_.get()) |
1467 return NULL; | 1469 return NULL; |
1468 | 1470 |
1469 if (gpu_channel_->IsLost()) | 1471 if (gpu_channel_->IsLost()) |
1470 return NULL; | 1472 return NULL; |
1471 | 1473 |
1472 return gpu_channel_.get(); | 1474 return gpu_channel_.get(); |
1473 } | 1475 } |
1474 | 1476 |
1477 #if defined(ENABLE_PLUGINS) | |
1475 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { | 1478 void RenderThreadImpl::OnPurgePluginListCache(bool reload_pages) { |
1476 EnsureWebKitInitialized(); | 1479 EnsureWebKitInitialized(); |
1477 // The call below will cause a GetPlugins call with refresh=true, but at this | 1480 // The call below will cause a GetPlugins call with refresh=true, but at this |
1478 // point we already know that the browser has refreshed its list, so disable | 1481 // point we already know that the browser has refreshed its list, so disable |
1479 // refresh temporarily to prevent each renderer process causing the list to be | 1482 // refresh temporarily to prevent each renderer process causing the list to be |
1480 // regenerated. | 1483 // regenerated. |
1481 webkit_platform_support_->set_plugin_refresh_allowed(false); | 1484 webkit_platform_support_->set_plugin_refresh_allowed(false); |
1482 blink::resetPluginCache(reload_pages); | 1485 blink::resetPluginCache(reload_pages); |
1483 webkit_platform_support_->set_plugin_refresh_allowed(true); | 1486 webkit_platform_support_->set_plugin_refresh_allowed(true); |
1484 | 1487 |
1485 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, PluginListChanged()); | 1488 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, PluginListChanged()); |
1486 } | 1489 } |
1490 #endif | |
1487 | 1491 |
1488 void RenderThreadImpl::OnNetworkTypeChanged( | 1492 void RenderThreadImpl::OnNetworkTypeChanged( |
1489 net::NetworkChangeNotifier::ConnectionType type) { | 1493 net::NetworkChangeNotifier::ConnectionType type) { |
1490 EnsureWebKitInitialized(); | 1494 EnsureWebKitInitialized(); |
1491 bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; | 1495 bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; |
1492 WebNetworkStateNotifier::setOnLine(online); | 1496 WebNetworkStateNotifier::setOnLine(online); |
1493 FOR_EACH_OBSERVER( | 1497 FOR_EACH_OBSERVER( |
1494 RenderProcessObserver, observers_, NetworkStateChanged(online)); | 1498 RenderProcessObserver, observers_, NetworkStateChanged(online)); |
1495 WebNetworkStateNotifier::setWebConnectionType( | 1499 WebNetworkStateNotifier::setWebConnectionType( |
1496 NetConnectionTypeToWebConnectionType(type)); | 1500 NetConnectionTypeToWebConnectionType(type)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1596 #endif | 1600 #endif |
1597 } | 1601 } |
1598 return media_thread_->message_loop_proxy(); | 1602 return media_thread_->message_loop_proxy(); |
1599 } | 1603 } |
1600 | 1604 |
1601 void RenderThreadImpl::SetFlingCurveParameters( | 1605 void RenderThreadImpl::SetFlingCurveParameters( |
1602 const std::vector<float>& new_touchpad, | 1606 const std::vector<float>& new_touchpad, |
1603 const std::vector<float>& new_touchscreen) { | 1607 const std::vector<float>& new_touchscreen) { |
1604 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, | 1608 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, |
1605 new_touchscreen); | 1609 new_touchscreen); |
1606 | |
1607 } | 1610 } |
1608 | 1611 |
1609 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { | 1612 void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) { |
1610 webkit_platform_support_->sampleGamepads(*data); | 1613 webkit_platform_support_->sampleGamepads(*data); |
1611 } | 1614 } |
1612 | 1615 |
1613 void RenderThreadImpl::WidgetCreated() { | 1616 void RenderThreadImpl::WidgetCreated() { |
1614 widget_count_++; | 1617 widget_count_++; |
1615 } | 1618 } |
1616 | 1619 |
(...skipping 22 matching lines...) Expand all Loading... | |
1639 hidden_widget_count_--; | 1642 hidden_widget_count_--; |
1640 | 1643 |
1641 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1644 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1642 return; | 1645 return; |
1643 } | 1646 } |
1644 | 1647 |
1645 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1648 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1646 } | 1649 } |
1647 | 1650 |
1648 } // namespace content | 1651 } // namespace content |
OLD | NEW |