license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 5 | #include "chrome/renderer/render_thread.h" |
| 6 | |
[email protected] | da00a288 | 2009-03-09 17:51:19 | [diff] [blame] | 7 | #include <algorithm> |
| 8 | #include <vector> |
| 9 | |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 10 | #include "base/command_line.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 11 | #include "base/shared_memory.h" |
[email protected] | da00a288 | 2009-03-09 17:51:19 | [diff] [blame] | 12 | #include "base/stats_table.h" |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 13 | #include "chrome/common/chrome_switches.h" |
[email protected] | e09ba55 | 2009-02-05 03:26:29 | [diff] [blame] | 14 | #include "chrome/common/render_messages.h" |
[email protected] | 173de1b | 2008-08-15 18:36:46 | [diff] [blame] | 15 | #include "chrome/common/notification_service.h" |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 16 | #include "chrome/common/url_constants.h" |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 17 | #include "chrome/plugin/npobject_util.h" |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 18 | // TODO(port) |
| 19 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 20 | #include "chrome/plugin/plugin_channel.h" |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 21 | #else |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 22 | #include "base/scoped_handle.h" |
| 23 | #include "chrome/plugin/plugin_channel_base.h" |
| 24 | #include "webkit/glue/weburlrequest.h" |
| 25 | #endif |
[email protected] | 309d7a28 | 2009-03-24 09:18:27 | [diff] [blame] | 26 | #include "chrome/renderer/extensions/extension_process_bindings.h" |
[email protected] | 0aa477bd | 2009-03-23 22:21:43 | [diff] [blame] | 27 | #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 28 | #include "chrome/renderer/net/render_dns_master.h" |
| 29 | #include "chrome/renderer/render_process.h" |
| 30 | #include "chrome/renderer/render_view.h" |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 31 | #include "chrome/renderer/renderer_webkitclient_impl.h" |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 32 | #include "chrome/renderer/user_script_slave.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 33 | #include "chrome/renderer/visitedlink_slave.h" |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 34 | #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" |
| 35 | #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 36 | #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 37 | #include "webkit/extensions/v8/gears_extension.h" |
| 38 | #include "webkit/extensions/v8/interval_extension.h" |
| 39 | #include "webkit/extensions/v8/playback_extension.h" |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 40 | |
[email protected] | da00a288 | 2009-03-09 17:51:19 | [diff] [blame] | 41 | #if defined(OS_WIN) |
| 42 | #include <windows.h> |
| 43 | #include <objbase.h> |
| 44 | #endif |
| 45 | |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 46 | using WebKit::WebCache; |
| 47 | using WebKit::WebString; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 48 | |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 49 | static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 50 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 51 | //----------------------------------------------------------------------------- |
| 52 | // Methods below are only called on the owner's thread: |
| 53 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 54 | // When we run plugins in process, we actually run them on the render thread, |
| 55 | // which means that we need to make the render thread pump UI events. |
| 56 | RenderThread::RenderThread() |
| 57 | : ChildThread( |
| 58 | base::Thread::Options(RenderProcess::InProcessPlugins() ? |
[email protected] | eb47a13 | 2009-03-04 00:39:56 | [diff] [blame] | 59 | MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT, kV8StackSize)) { |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | RenderThread::RenderThread(const std::wstring& channel_name) |
| 63 | : ChildThread( |
| 64 | base::Thread::Options(RenderProcess::InProcessPlugins() ? |
[email protected] | eb47a13 | 2009-03-04 00:39:56 | [diff] [blame] | 65 | MessageLoop::TYPE_UI : MessageLoop::TYPE_DEFAULT, kV8StackSize)) { |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 66 | SetChannelName(channel_name); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | RenderThread::~RenderThread() { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 70 | } |
| 71 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 72 | RenderThread* RenderThread::current() { |
| 73 | DCHECK(!IsPluginProcess()); |
| 74 | return static_cast<RenderThread*>(ChildThread::current()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void RenderThread::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 78 | channel()->AddFilter(filter); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | void RenderThread::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) { |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 82 | channel()->RemoveFilter(filter); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | void RenderThread::Resolve(const char* name, size_t length) { |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 86 | return dns_master_->Resolve(name, length); |
[email protected] | 81a3441 | 2009-01-05 19:17:24 | [diff] [blame] | 87 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 88 | |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 89 | void RenderThread::SendHistograms() { |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 90 | return histogram_snapshots_->SendHistograms(); |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 91 | } |
| 92 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 93 | void RenderThread::Init() { |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 94 | // TODO(darin): Why do we need COM here? This is probably bogus. |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 95 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 96 | // The renderer thread should wind-up COM. |
| 97 | CoInitialize(0); |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 98 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 99 | |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 100 | ChildThread::Init(); |
| 101 | notification_service_.reset(new NotificationService); |
| 102 | cache_stats_factory_.reset( |
| 103 | new ScopedRunnableMethodFactory<RenderThread>(this)); |
| 104 | |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 105 | visited_link_slave_.reset(new VisitedLinkSlave()); |
| 106 | user_script_slave_.reset(new UserScriptSlave()); |
| 107 | dns_master_.reset(new RenderDnsMaster()); |
| 108 | histogram_snapshots_.reset(new RendererHistogramSnapshots()); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | void RenderThread::CleanUp() { |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 112 | // Shutdown in reverse of the initialization order. |
| 113 | |
| 114 | histogram_snapshots_.reset(); |
| 115 | dns_master_.reset(); |
| 116 | user_script_slave_.reset(); |
| 117 | visited_link_slave_.reset(); |
| 118 | |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 119 | if (webkit_client_.get()) { |
| 120 | WebKit::shutdown(); |
| 121 | webkit_client_.reset(); |
| 122 | } |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 123 | |
| 124 | notification_service_.reset(); |
| 125 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 126 | ChildThread::CleanUp(); |
[email protected] | 8fd8de9 | 2008-08-12 23:50:30 | [diff] [blame] | 127 | |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 128 | // TODO(port) |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 129 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 130 | // Clean up plugin channels before this thread goes away. |
| 131 | PluginChannelBase::CleanupChannels(); |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 132 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 133 | |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 134 | #if defined(OS_WIN) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 135 | CoUninitialize(); |
[email protected] | 2c62b56 | 2009-01-27 19:04:50 | [diff] [blame] | 136 | #endif |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 137 | } |
| 138 | |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 139 | void RenderThread::OnUpdateVisitedLinks(base::SharedMemoryHandle table) { |
[email protected] | 5fe733de | 2009-02-11 18:59:20 | [diff] [blame] | 140 | DCHECK(base::SharedMemory::IsHandleValid(table)) << "Bad table handle"; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 141 | visited_link_slave_->Init(table); |
| 142 | } |
| 143 | |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 144 | void RenderThread::OnUpdateUserScripts( |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 145 | base::SharedMemoryHandle scripts) { |
[email protected] | 5fe733de | 2009-02-11 18:59:20 | [diff] [blame] | 146 | DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle"; |
[email protected] | 0938d3c | 2009-01-09 20:37:35 | [diff] [blame] | 147 | user_script_slave_->UpdateScripts(scripts); |
[email protected] | 1e0f7040 | 2008-10-16 23:57:47 | [diff] [blame] | 148 | } |
| 149 | |
[email protected] | 703e807a | 2009-03-28 19:56:51 | [diff] [blame] | 150 | void RenderThread::OnSetExtensionFunctionNames( |
| 151 | const std::vector<std::string>& names) { |
| 152 | extensions_v8::ExtensionProcessBindings::SetFunctionNames(names); |
| 153 | } |
| 154 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 155 | void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 156 | IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) |
| 157 | IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) |
| 158 | IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) |
| 159 | // TODO(port): removed from render_messages_internal.h; |
| 160 | // is there a new non-windows message I should add here? |
| 161 | IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) |
| 162 | IPC_MESSAGE_HANDLER(ViewMsg_SetCacheCapacities, OnSetCacheCapacities) |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 163 | IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms, |
| 164 | OnGetRendererHistograms) |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 165 | IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats, |
| 166 | OnGetCacheResourceStats) |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 167 | IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_NewScripts, |
| 168 | OnUpdateUserScripts) |
[email protected] | 75e5a87 | 2009-04-02 23:56:11 | [diff] [blame^] | 169 | IPC_MESSAGE_HANDLER(ViewMsg_ExtensionHandleConnect, |
| 170 | OnExtensionHandleConnect) |
| 171 | IPC_MESSAGE_HANDLER(ViewMsg_ExtensionHandleMessage, |
| 172 | OnExtensionHandleMessage) |
[email protected] | 703e807a | 2009-03-28 19:56:51 | [diff] [blame] | 173 | IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames, |
| 174 | OnSetExtensionFunctionNames) |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 175 | IPC_END_MESSAGE_MAP() |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | void RenderThread::OnSetNextPageID(int32 next_page_id) { |
| 179 | // This should only be called at process initialization time, so we shouldn't |
| 180 | // have to worry about thread-safety. |
| 181 | RenderView::SetNextPageID(next_page_id); |
| 182 | } |
| 183 | |
[email protected] | 18bcc3c | 2009-01-27 21:39:15 | [diff] [blame] | 184 | void RenderThread::OnCreateNewView(gfx::NativeViewId parent_hwnd, |
| 185 | ModalDialogEvent modal_dialog_event, |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 186 | const WebPreferences& webkit_prefs, |
| 187 | int32 view_id) { |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 188 | EnsureWebKitInitialized(); |
| 189 | |
[email protected] | be645db | 2009-02-06 20:36:33 | [diff] [blame] | 190 | // When bringing in render_view, also bring in webkit's glue and jsbindings. |
[email protected] | 18bcc3c | 2009-01-27 21:39:15 | [diff] [blame] | 191 | base::WaitableEvent* waitable_event = new base::WaitableEvent( |
| 192 | #if defined(OS_WIN) |
| 193 | modal_dialog_event.event); |
| 194 | #else |
| 195 | true, false); |
| 196 | #endif |
| 197 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 198 | // TODO(darin): once we have a RenderThread per RenderView, this will need to |
| 199 | // change to assert that we are not creating more than one view. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 200 | RenderView::Create( |
[email protected] | 1c4947f | 2009-01-15 22:25:11 | [diff] [blame] | 201 | this, parent_hwnd, waitable_event, MSG_ROUTING_NONE, webkit_prefs, |
[email protected] | 0aa5531 | 2008-10-17 21:53:08 | [diff] [blame] | 202 | new SharedRenderViewCounter(0), view_id); |
[email protected] | 7f874dec | 2009-02-06 01:48:27 | [diff] [blame] | 203 | } |
[email protected] | 4274e58 | 2009-01-27 22:09:56 | [diff] [blame] | 204 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 205 | void RenderThread::OnSetCacheCapacities(size_t min_dead_capacity, |
| 206 | size_t max_dead_capacity, |
| 207 | size_t capacity) { |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 208 | EnsureWebKitInitialized(); |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 209 | WebCache::setCapacities( |
| 210 | min_dead_capacity, max_dead_capacity, capacity); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | void RenderThread::OnGetCacheResourceStats() { |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 214 | EnsureWebKitInitialized(); |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 215 | WebCache::ResourceTypeStats stats; |
| 216 | WebCache::getResourceTypeStats(&stats); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 217 | Send(new ViewHostMsg_ResourceTypeStats(stats)); |
| 218 | } |
| 219 | |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 220 | void RenderThread::OnGetRendererHistograms() { |
| 221 | SendHistograms(); |
| 222 | } |
| 223 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 224 | void RenderThread::InformHostOfCacheStats() { |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 225 | EnsureWebKitInitialized(); |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 226 | WebCache::UsageStats stats; |
| 227 | WebCache::getUsageStats(&stats); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 228 | Send(new ViewHostMsg_UpdatedCacheStats(stats)); |
| 229 | } |
| 230 | |
| 231 | void RenderThread::InformHostOfCacheStatsLater() { |
| 232 | // Rate limit informing the host of our cache stats. |
| 233 | if (!cache_stats_factory_->empty()) |
| 234 | return; |
| 235 | |
| 236 | MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 237 | cache_stats_factory_->NewRunnableMethod( |
| 238 | &RenderThread::InformHostOfCacheStats), |
| 239 | kCacheStatsDelayMS); |
| 240 | } |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 241 | |
[email protected] | 3df0c20 | 2009-03-31 23:51:26 | [diff] [blame] | 242 | static void* CreateHistogram( |
| 243 | const char *name, int min, int max, size_t buckets) { |
| 244 | return new Histogram(name, min, max, buckets); |
| 245 | } |
| 246 | |
| 247 | static void AddHistogramSample(void* hist, int sample) { |
| 248 | Histogram* histogram = static_cast<Histogram *>(hist); |
| 249 | histogram->Add(sample); |
| 250 | } |
| 251 | |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 252 | void RenderThread::EnsureWebKitInitialized() { |
| 253 | if (webkit_client_.get()) |
| 254 | return; |
[email protected] | da00a288 | 2009-03-09 17:51:19 | [diff] [blame] | 255 | |
| 256 | v8::V8::SetCounterFunction(StatsTable::FindLocation); |
[email protected] | 3df0c20 | 2009-03-31 23:51:26 | [diff] [blame] | 257 | v8::V8::SetCreateHistogramFunction(CreateHistogram); |
| 258 | v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); |
[email protected] | da00a288 | 2009-03-09 17:51:19 | [diff] [blame] | 259 | |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 260 | webkit_client_.reset(new RendererWebKitClientImpl); |
| 261 | WebKit::initialize(webkit_client_.get()); |
[email protected] | 8881eca8 | 2009-03-12 18:20:44 | [diff] [blame] | 262 | |
| 263 | // chrome-ui pages should not be accessible by normal content, and should |
| 264 | // also be unable to script anything but themselves (to help limit the damage |
| 265 | // that a corrupt chrome-ui page could cause). |
[email protected] | 2c434b3 | 2009-03-19 06:27:47 | [diff] [blame] | 266 | WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); |
[email protected] | 8881eca8 | 2009-03-12 18:20:44 | [diff] [blame] | 267 | WebKit::registerURLSchemeAsLocal(chrome_ui_scheme); |
| 268 | WebKit::registerURLSchemeAsNoAccess(chrome_ui_scheme); |
[email protected] | da00a288 | 2009-03-09 17:51:19 | [diff] [blame] | 269 | |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 270 | WebKit::registerExtension(extensions_v8::GearsExtension::Get()); |
| 271 | WebKit::registerExtension(extensions_v8::IntervalExtension::Get()); |
[email protected] | 75e5a87 | 2009-04-02 23:56:11 | [diff] [blame^] | 272 | WebKit::registerExtension( |
| 273 | extensions_v8::RendererExtensionBindings::Get(this)); |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 274 | |
[email protected] | 309d7a28 | 2009-03-24 09:18:27 | [diff] [blame] | 275 | WebKit::registerExtension(extensions_v8::ExtensionProcessBindings::Get(), |
| 276 | WebKit::WebString::fromUTF8(chrome::kExtensionScheme)); |
| 277 | |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 278 | const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 279 | if (command_line.HasSwitch(switches::kPlaybackMode) || |
| 280 | command_line.HasSwitch(switches::kRecordMode)) { |
| 281 | WebKit::registerExtension(extensions_v8::PlaybackExtension::Get()); |
| 282 | } |
[email protected] | 2cb8233 | 2009-03-18 17:24:55 | [diff] [blame] | 283 | |
| 284 | if (command_line.HasSwitch(switches::kEnableWebWorkers)) { |
[email protected] | 0b9a1cc9 | 2009-03-19 00:55:53 | [diff] [blame] | 285 | WebKit::enableWebWorkers(); |
[email protected] | 2cb8233 | 2009-03-18 17:24:55 | [diff] [blame] | 286 | } |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 287 | } |
[email protected] | 75e5a87 | 2009-04-02 23:56:11 | [diff] [blame^] | 288 | |
| 289 | void RenderThread::OnExtensionHandleConnect(int port_id) { |
| 290 | extensions_v8::RendererExtensionBindings::HandleConnect(port_id); |
| 291 | } |
| 292 | |
| 293 | void RenderThread::OnExtensionHandleMessage(const std::string& message, |
| 294 | int port_id) { |
| 295 | extensions_v8::RendererExtensionBindings::HandleMessage(message, port_id); |
| 296 | } |