OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/renderer/render_thread.h" | 5 #include "chrome/renderer/render_thread.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/renderer/extensions/event_bindings.h" | 36 #include "chrome/renderer/extensions/event_bindings.h" |
37 #include "chrome/renderer/extensions/extension_process_bindings.h" | 37 #include "chrome/renderer/extensions/extension_process_bindings.h" |
38 #include "chrome/renderer/extensions/js_only_v8_extensions.h" | 38 #include "chrome/renderer/extensions/js_only_v8_extensions.h" |
39 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 39 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
40 #include "chrome/renderer/external_extension.h" | 40 #include "chrome/renderer/external_extension.h" |
41 #include "chrome/renderer/loadtimes_extension_bindings.h" | 41 #include "chrome/renderer/loadtimes_extension_bindings.h" |
42 #include "chrome/renderer/net/render_dns_master.h" | 42 #include "chrome/renderer/net/render_dns_master.h" |
43 #include "chrome/renderer/render_process.h" | 43 #include "chrome/renderer/render_process.h" |
44 #include "chrome/renderer/render_view.h" | 44 #include "chrome/renderer/render_view.h" |
45 #include "chrome/renderer/renderer_webkitclient_impl.h" | 45 #include "chrome/renderer/renderer_webkitclient_impl.h" |
| 46 #include "chrome/renderer/socket_stream_dispatcher.h" |
46 #include "chrome/renderer/user_script_slave.h" | 47 #include "chrome/renderer/user_script_slave.h" |
47 #include "ipc/ipc_message.h" | 48 #include "ipc/ipc_message.h" |
48 #include "webkit/api/public/WebCache.h" | 49 #include "webkit/api/public/WebCache.h" |
49 #include "webkit/api/public/WebColor.h" | 50 #include "webkit/api/public/WebColor.h" |
50 #include "webkit/api/public/WebCrossOriginPreflightResultCache.h" | 51 #include "webkit/api/public/WebCrossOriginPreflightResultCache.h" |
51 #include "webkit/api/public/WebFontCache.h" | 52 #include "webkit/api/public/WebFontCache.h" |
52 #include "webkit/api/public/WebColor.h" | 53 #include "webkit/api/public/WebColor.h" |
53 #include "webkit/api/public/WebKit.h" | 54 #include "webkit/api/public/WebKit.h" |
54 #include "webkit/api/public/WebStorageEventDispatcher.h" | 55 #include "webkit/api/public/WebStorageEventDispatcher.h" |
55 #include "webkit/api/public/WebString.h" | 56 #include "webkit/api/public/WebString.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 widget_count_ = 0; | 126 widget_count_ = 0; |
126 hidden_widget_count_ = 0; | 127 hidden_widget_count_ = 0; |
127 idle_notification_delay_in_s_ = kInitialIdleHandlerDelayS; | 128 idle_notification_delay_in_s_ = kInitialIdleHandlerDelayS; |
128 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); | 129 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this)); |
129 | 130 |
130 visited_link_slave_.reset(new VisitedLinkSlave()); | 131 visited_link_slave_.reset(new VisitedLinkSlave()); |
131 user_script_slave_.reset(new UserScriptSlave()); | 132 user_script_slave_.reset(new UserScriptSlave()); |
132 dns_master_.reset(new RenderDnsMaster()); | 133 dns_master_.reset(new RenderDnsMaster()); |
133 histogram_snapshots_.reset(new RendererHistogramSnapshots()); | 134 histogram_snapshots_.reset(new RendererHistogramSnapshots()); |
134 appcache_dispatcher_.reset(new AppCacheDispatcher(this)); | 135 appcache_dispatcher_.reset(new AppCacheDispatcher(this)); |
| 136 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
135 devtools_agent_filter_ = new DevToolsAgentFilter(); | 137 devtools_agent_filter_ = new DevToolsAgentFilter(); |
136 AddFilter(devtools_agent_filter_.get()); | 138 AddFilter(devtools_agent_filter_.get()); |
137 db_message_filter_ = new DBMessageFilter(); | 139 db_message_filter_ = new DBMessageFilter(); |
138 AddFilter(db_message_filter_.get()); | 140 AddFilter(db_message_filter_.get()); |
139 | 141 |
140 #if defined(OS_POSIX) | 142 #if defined(OS_POSIX) |
141 suicide_on_channel_error_filter_ = new SuicideOnChannelErrorFilter; | 143 suicide_on_channel_error_filter_ = new SuicideOnChannelErrorFilter; |
142 AddFilter(suicide_on_channel_error_filter_.get()); | 144 AddFilter(suicide_on_channel_error_filter_.get()); |
143 #endif | 145 #endif |
144 } | 146 } |
145 | 147 |
146 RenderThread::~RenderThread() { | 148 RenderThread::~RenderThread() { |
147 // Shutdown in reverse of the initialization order. | 149 // Shutdown in reverse of the initialization order. |
148 RemoveFilter(devtools_agent_filter_.get()); | 150 RemoveFilter(devtools_agent_filter_.get()); |
149 RemoveFilter(db_message_filter_.get()); | 151 RemoveFilter(db_message_filter_.get()); |
150 db_message_filter_ = NULL; | 152 db_message_filter_ = NULL; |
| 153 socket_stream_dispatcher_.reset(); |
151 if (webkit_client_.get()) | 154 if (webkit_client_.get()) |
152 WebKit::shutdown(); | 155 WebKit::shutdown(); |
153 | 156 |
154 lazy_tls.Pointer()->Set(NULL); | 157 lazy_tls.Pointer()->Set(NULL); |
155 | 158 |
156 // TODO(port) | 159 // TODO(port) |
157 #if defined(OS_WIN) | 160 #if defined(OS_WIN) |
158 // Clean up plugin channels before this thread goes away. | 161 // Clean up plugin channels before this thread goes away. |
159 PluginChannelBase::CleanupChannels(); | 162 PluginChannelBase::CleanupChannels(); |
160 // Don't call COM if the renderer is in the sandbox. | 163 // Don't call COM if the renderer is in the sandbox. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 void RenderThread::OnExtensionSetL10nMessages( | 266 void RenderThread::OnExtensionSetL10nMessages( |
264 const std::string& extension_id, | 267 const std::string& extension_id, |
265 const std::map<std::string, std::string>& l10n_messages) { | 268 const std::map<std::string, std::string>& l10n_messages) { |
266 ExtensionProcessBindings::SetL10nMessages(extension_id, l10n_messages); | 269 ExtensionProcessBindings::SetL10nMessages(extension_id, l10n_messages); |
267 } | 270 } |
268 | 271 |
269 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { | 272 void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { |
270 // App cache messages are handled by a delegate. | 273 // App cache messages are handled by a delegate. |
271 if (appcache_dispatcher_->OnMessageReceived(msg)) | 274 if (appcache_dispatcher_->OnMessageReceived(msg)) |
272 return; | 275 return; |
| 276 if (socket_stream_dispatcher_->OnMessageReceived(msg)) |
| 277 return; |
273 | 278 |
274 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) | 279 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) |
275 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) | 280 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) |
276 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) | 281 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) |
277 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks) | 282 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks) |
278 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) | 283 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) |
279 IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors) | 284 IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors) |
280 // TODO(port): removed from render_messages_internal.h; | 285 // TODO(port): removed from render_messages_internal.h; |
281 // is there a new non-windows message I should add here? | 286 // is there a new non-windows message I should add here? |
282 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) | 287 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 void RenderThread::OnPurgePluginListCache(bool reload_pages) { | 565 void RenderThread::OnPurgePluginListCache(bool reload_pages) { |
561 EnsureWebKitInitialized(); | 566 EnsureWebKitInitialized(); |
562 // The call below will cause a GetPlugins call with refresh=true, but at this | 567 // The call below will cause a GetPlugins call with refresh=true, but at this |
563 // point we already know that the browser has refreshed its list, so disable | 568 // point we already know that the browser has refreshed its list, so disable |
564 // refresh temporarily to prevent each renderer process causing the list to be | 569 // refresh temporarily to prevent each renderer process causing the list to be |
565 // regenerated. | 570 // regenerated. |
566 plugin_refresh_allowed_ = false; | 571 plugin_refresh_allowed_ = false; |
567 WebKit::resetPluginCache(reload_pages); | 572 WebKit::resetPluginCache(reload_pages); |
568 plugin_refresh_allowed_ = true; | 573 plugin_refresh_allowed_ = true; |
569 } | 574 } |
OLD | NEW |