| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // So, we install a filter on the channel so that we can process this event | 80 // So, we install a filter on the channel so that we can process this event |
| 81 // here and kill the process. | 81 // here and kill the process. |
| 82 _exit(0); | 82 _exit(0); |
| 83 } | 83 } |
| 84 }; | 84 }; |
| 85 #endif | 85 #endif |
| 86 } // namespace | 86 } // namespace |
| 87 | 87 |
| 88 // When we run plugins in process, we actually run them on the render thread, | 88 // When we run plugins in process, we actually run them on the render thread, |
| 89 // which means that we need to make the render thread pump UI events. | 89 // which means that we need to make the render thread pump UI events. |
| 90 RenderThread::RenderThread() | 90 RenderThread::RenderThread() { |
| 91 : plugin_refresh_allowed_(true) { | |
| 92 Init(); | 91 Init(); |
| 93 } | 92 } |
| 94 | 93 |
| 95 RenderThread::RenderThread(const std::string& channel_name) | 94 RenderThread::RenderThread(const std::string& channel_name) |
| 96 : plugin_refresh_allowed_(true) { | 95 : ChildThread(channel_name) { |
| 97 SetChannelName(channel_name); | |
| 98 Init(); | 96 Init(); |
| 99 } | 97 } |
| 100 | 98 |
| 101 void RenderThread::Init() { | 99 void RenderThread::Init() { |
| 102 lazy_tls.Pointer()->Set(this); | 100 lazy_tls.Pointer()->Set(this); |
| 103 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
| 104 // If you are running plugins in this thread you need COM active but in | 102 // If you are running plugins in this thread you need COM active but in |
| 105 // the normal case you don't. | 103 // the normal case you don't. |
| 106 if (RenderProcess::InProcessPlugins()) | 104 if (RenderProcess::InProcessPlugins()) |
| 107 CoInitialize(0); | 105 CoInitialize(0); |
| 108 #endif | 106 #endif |
| 109 | 107 |
| 108 plugin_refresh_allowed_ = true; |
| 110 cache_stats_factory_.reset( | 109 cache_stats_factory_.reset( |
| 111 new ScopedRunnableMethodFactory<RenderThread>(this)); | 110 new ScopedRunnableMethodFactory<RenderThread>(this)); |
| 112 | 111 |
| 113 visited_link_slave_.reset(new VisitedLinkSlave()); | 112 visited_link_slave_.reset(new VisitedLinkSlave()); |
| 114 user_script_slave_.reset(new UserScriptSlave()); | 113 user_script_slave_.reset(new UserScriptSlave()); |
| 115 dns_master_.reset(new RenderDnsMaster()); | 114 dns_master_.reset(new RenderDnsMaster()); |
| 116 histogram_snapshots_.reset(new RendererHistogramSnapshots()); | 115 histogram_snapshots_.reset(new RendererHistogramSnapshots()); |
| 117 app_cache_dispatcher_.reset(new AppCacheDispatcher()); | 116 app_cache_dispatcher_.reset(new AppCacheDispatcher()); |
| 118 WebAppCacheContext::SetFactory(CreateAppCacheContextForRenderer); | 117 WebAppCacheContext::SetFactory(CreateAppCacheContextForRenderer); |
| 119 devtools_agent_filter_ = new DevToolsAgentFilter(); | 118 devtools_agent_filter_ = new DevToolsAgentFilter(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 378 |
| 380 void RenderThread::OnPurgePluginListCache() { | 379 void RenderThread::OnPurgePluginListCache() { |
| 381 // The call below will cause a GetPlugins call with refresh=true, but at this | 380 // The call below will cause a GetPlugins call with refresh=true, but at this |
| 382 // point we already know that the browser has refreshed its list, so disable | 381 // point we already know that the browser has refreshed its list, so disable |
| 383 // refresh temporarily to prevent each renderer process causing the list to be | 382 // refresh temporarily to prevent each renderer process causing the list to be |
| 384 // regenerated. | 383 // regenerated. |
| 385 plugin_refresh_allowed_ = false; | 384 plugin_refresh_allowed_ = false; |
| 386 WebKit::resetPluginCache(); | 385 WebKit::resetPluginCache(); |
| 387 plugin_refresh_allowed_ = true; | 386 plugin_refresh_allowed_ = true; |
| 388 } | 387 } |
| OLD | NEW |