OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 23 matching lines...) Expand all Loading... |
34 #include "chrome/renderer/loadtimes_extension_bindings.h" | 34 #include "chrome/renderer/loadtimes_extension_bindings.h" |
35 #include "chrome/renderer/net/render_dns_master.h" | 35 #include "chrome/renderer/net/render_dns_master.h" |
36 #include "chrome/renderer/render_process.h" | 36 #include "chrome/renderer/render_process.h" |
37 #include "chrome/renderer/render_view.h" | 37 #include "chrome/renderer/render_view.h" |
38 #include "chrome/renderer/renderer_webkitclient_impl.h" | 38 #include "chrome/renderer/renderer_webkitclient_impl.h" |
39 #include "chrome/renderer/user_script_slave.h" | 39 #include "chrome/renderer/user_script_slave.h" |
40 #include "chrome/renderer/visitedlink_slave.h" | 40 #include "chrome/renderer/visitedlink_slave.h" |
41 #include "webkit/api/public/WebCache.h" | 41 #include "webkit/api/public/WebCache.h" |
42 #include "webkit/api/public/WebKit.h" | 42 #include "webkit/api/public/WebKit.h" |
43 #include "webkit/api/public/WebString.h" | 43 #include "webkit/api/public/WebString.h" |
| 44 #include "webkit/extensions/v8/benchmarking_extension.h" |
44 #include "webkit/extensions/v8/gears_extension.h" | 45 #include "webkit/extensions/v8/gears_extension.h" |
45 #include "webkit/extensions/v8/interval_extension.h" | 46 #include "webkit/extensions/v8/interval_extension.h" |
46 #include "webkit/extensions/v8/playback_extension.h" | 47 #include "webkit/extensions/v8/playback_extension.h" |
47 | 48 |
48 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
49 #include <windows.h> | 50 #include <windows.h> |
50 #include <objbase.h> | 51 #include <objbase.h> |
51 #endif | 52 #endif |
52 | 53 |
53 using WebKit::WebCache; | 54 using WebKit::WebCache; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // Rate limit informing the host of our cache stats. | 290 // Rate limit informing the host of our cache stats. |
290 if (!cache_stats_factory_->empty()) | 291 if (!cache_stats_factory_->empty()) |
291 return; | 292 return; |
292 | 293 |
293 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 294 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
294 cache_stats_factory_->NewRunnableMethod( | 295 cache_stats_factory_->NewRunnableMethod( |
295 &RenderThread::InformHostOfCacheStats), | 296 &RenderThread::InformHostOfCacheStats), |
296 kCacheStatsDelayMS); | 297 kCacheStatsDelayMS); |
297 } | 298 } |
298 | 299 |
| 300 void RenderThread::CloseIdleConnections() { |
| 301 Send(new ViewHostMsg_CloseIdleConnections()); |
| 302 } |
| 303 |
| 304 void RenderThread::SetCacheMode(bool enabled) { |
| 305 Send(new ViewHostMsg_SetCacheMode(enabled)); |
| 306 } |
| 307 |
299 static void* CreateHistogram( | 308 static void* CreateHistogram( |
300 const char *name, int min, int max, size_t buckets) { | 309 const char *name, int min, int max, size_t buckets) { |
301 Histogram* histogram = new Histogram(name, min, max, buckets); | 310 Histogram* histogram = new Histogram(name, min, max, buckets); |
302 if (histogram) { | 311 if (histogram) { |
303 histogram->SetFlags(kUmaTargetedHistogramFlag); | 312 histogram->SetFlags(kUmaTargetedHistogramFlag); |
304 } | 313 } |
305 return histogram; | 314 return histogram; |
306 } | 315 } |
307 | 316 |
308 static void AddHistogramSample(void* hist, int sample) { | 317 static void AddHistogramSample(void* hist, int sample) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 352 |
344 // TODO(aa): Add a way to restrict extensions to the content script context | 353 // TODO(aa): Add a way to restrict extensions to the content script context |
345 // only so that we don't have to gate these on --enable-extensions. | 354 // only so that we don't have to gate these on --enable-extensions. |
346 if (command_line.HasSwitch(switches::kEnableExtensions)) { | 355 if (command_line.HasSwitch(switches::kEnableExtensions)) { |
347 WebKit::registerExtension(BaseJsV8Extension::Get()); | 356 WebKit::registerExtension(BaseJsV8Extension::Get()); |
348 WebKit::registerExtension(JsonSchemaJsV8Extension::Get()); | 357 WebKit::registerExtension(JsonSchemaJsV8Extension::Get()); |
349 WebKit::registerExtension(EventBindings::Get()); | 358 WebKit::registerExtension(EventBindings::Get()); |
350 WebKit::registerExtension(RendererExtensionBindings::Get()); | 359 WebKit::registerExtension(RendererExtensionBindings::Get()); |
351 } | 360 } |
352 | 361 |
| 362 if (command_line.HasSwitch(switches::kEnableBenchmarking)) |
| 363 WebKit::registerExtension(extensions_v8::BenchmarkingExtension::Get()); |
| 364 |
353 if (command_line.HasSwitch(switches::kPlaybackMode) || | 365 if (command_line.HasSwitch(switches::kPlaybackMode) || |
354 command_line.HasSwitch(switches::kRecordMode) || | 366 command_line.HasSwitch(switches::kRecordMode) || |
355 command_line.HasSwitch(switches::kNoJsRandomness)) { | 367 command_line.HasSwitch(switches::kNoJsRandomness)) { |
356 WebKit::registerExtension(extensions_v8::PlaybackExtension::Get()); | 368 WebKit::registerExtension(extensions_v8::PlaybackExtension::Get()); |
357 } | 369 } |
358 | 370 |
359 if (command_line.HasSwitch(switches::kEnableWebWorkers)) | 371 if (command_line.HasSwitch(switches::kEnableWebWorkers)) |
360 WebKit::enableWebWorkers(); | 372 WebKit::enableWebWorkers(); |
361 | 373 |
362 if (RenderProcess::current()->initialized_media_library()) | 374 if (RenderProcess::current()->initialized_media_library()) |
(...skipping 17 matching lines...) Expand all Loading... |
380 | 392 |
381 void RenderThread::OnPurgePluginListCache() { | 393 void RenderThread::OnPurgePluginListCache() { |
382 // The call below will cause a GetPlugins call with refresh=true, but at this | 394 // The call below will cause a GetPlugins call with refresh=true, but at this |
383 // point we already know that the browser has refreshed its list, so disable | 395 // point we already know that the browser has refreshed its list, so disable |
384 // refresh temporarily to prevent each renderer process causing the list to be | 396 // refresh temporarily to prevent each renderer process causing the list to be |
385 // regenerated. | 397 // regenerated. |
386 plugin_refresh_allowed_ = false; | 398 plugin_refresh_allowed_ = false; |
387 WebKit::resetPluginCache(); | 399 WebKit::resetPluginCache(); |
388 plugin_refresh_allowed_ = true; | 400 plugin_refresh_allowed_ = true; |
389 } | 401 } |
OLD | NEW |