| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/renderer_web_database_observer.h" | 46 #include "chrome/renderer/renderer_web_database_observer.h" |
| 47 #include "chrome/renderer/socket_stream_dispatcher.h" | 47 #include "chrome/renderer/socket_stream_dispatcher.h" |
| 48 #include "chrome/renderer/user_script_slave.h" | 48 #include "chrome/renderer/user_script_slave.h" |
| 49 #include "ipc/ipc_message.h" | 49 #include "ipc/ipc_message.h" |
| 50 #include "webkit/api/public/WebCache.h" | 50 #include "webkit/api/public/WebCache.h" |
| 51 #include "webkit/api/public/WebColor.h" | 51 #include "webkit/api/public/WebColor.h" |
| 52 #include "webkit/api/public/WebCrossOriginPreflightResultCache.h" | 52 #include "webkit/api/public/WebCrossOriginPreflightResultCache.h" |
| 53 #include "webkit/api/public/WebRuntimeFeatures.h" |
| 53 #include "webkit/api/public/WebFontCache.h" | 54 #include "webkit/api/public/WebFontCache.h" |
| 54 #include "webkit/api/public/WebColor.h" | 55 #include "webkit/api/public/WebColor.h" |
| 55 #include "webkit/api/public/WebDatabase.h" | 56 #include "webkit/api/public/WebDatabase.h" |
| 56 #include "webkit/api/public/WebKit.h" | 57 #include "webkit/api/public/WebKit.h" |
| 57 #include "webkit/api/public/WebScriptController.h" | 58 #include "webkit/api/public/WebScriptController.h" |
| 58 #include "webkit/api/public/WebSecurityPolicy.h" | 59 #include "webkit/api/public/WebSecurityPolicy.h" |
| 59 #include "webkit/api/public/WebStorageEventDispatcher.h" | 60 #include "webkit/api/public/WebStorageEventDispatcher.h" |
| 60 #include "webkit/api/public/WebString.h" | 61 #include "webkit/api/public/WebString.h" |
| 61 #include "webkit/extensions/v8/benchmarking_extension.h" | 62 #include "webkit/extensions/v8/benchmarking_extension.h" |
| 62 #include "webkit/extensions/v8/gears_extension.h" | 63 #include "webkit/extensions/v8/gears_extension.h" |
| 63 #include "webkit/extensions/v8/interval_extension.h" | 64 #include "webkit/extensions/v8/interval_extension.h" |
| 64 #include "webkit/extensions/v8/playback_extension.h" | 65 #include "webkit/extensions/v8/playback_extension.h" |
| 65 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" | 66 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" |
| 66 | 67 |
| 67 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 68 #include <windows.h> | 69 #include <windows.h> |
| 69 #include <objbase.h> | 70 #include <objbase.h> |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 72 using WebKit::WebCache; | 73 using WebKit::WebCache; |
| 73 using WebKit::WebCrossOriginPreflightResultCache; | 74 using WebKit::WebCrossOriginPreflightResultCache; |
| 75 using WebKit::WebRuntimeFeatures; |
| 74 using WebKit::WebFontCache; | 76 using WebKit::WebFontCache; |
| 75 using WebKit::WebSecurityPolicy; | 77 using WebKit::WebSecurityPolicy; |
| 76 using WebKit::WebScriptController; | 78 using WebKit::WebScriptController; |
| 77 using WebKit::WebString; | 79 using WebKit::WebString; |
| 78 using WebKit::WebStorageEventDispatcher; | 80 using WebKit::WebStorageEventDispatcher; |
| 79 using WebKit::WebView; | 81 using WebKit::WebView; |
| 80 | 82 |
| 81 namespace { | 83 namespace { |
| 82 static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */; | 84 static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */; |
| 83 static const double kInitialIdleHandlerDelayS = 1.0 /* seconds */; | 85 static const double kInitialIdleHandlerDelayS = 1.0 /* seconds */; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 extensions_v8::BenchmarkingExtension::Get()); | 513 extensions_v8::BenchmarkingExtension::Get()); |
| 512 } | 514 } |
| 513 | 515 |
| 514 if (command_line.HasSwitch(switches::kPlaybackMode) || | 516 if (command_line.HasSwitch(switches::kPlaybackMode) || |
| 515 command_line.HasSwitch(switches::kRecordMode) || | 517 command_line.HasSwitch(switches::kRecordMode) || |
| 516 command_line.HasSwitch(switches::kNoJsRandomness)) { | 518 command_line.HasSwitch(switches::kNoJsRandomness)) { |
| 517 WebScriptController::registerExtension( | 519 WebScriptController::registerExtension( |
| 518 extensions_v8::PlaybackExtension::Get()); | 520 extensions_v8::PlaybackExtension::Get()); |
| 519 } | 521 } |
| 520 | 522 |
| 521 if (RenderProcess::current()->initialized_media_library()) | 523 WebRuntimeFeatures::enableMediaPlayer( |
| 522 WebKit::enableMediaPlayer(); | 524 RenderProcess::current()->initialized_media_library()); |
| 523 | 525 |
| 524 if (command_line.HasSwitch(switches::kEnableWebSockets)) | 526 WebRuntimeFeatures::enableSockets( |
| 525 WebKit::enableWebSockets(); | 527 command_line.HasSwitch(switches::kEnableWebSockets)); |
| 526 | 528 |
| 527 if (command_line.HasSwitch(switches::kEnableDatabases)) | 529 WebRuntimeFeatures::enableDatabase( |
| 528 WebKit::enableDatabases(); | 530 command_line.HasSwitch(switches::kEnableDatabases)); |
| 529 } | 531 } |
| 530 | 532 |
| 531 void RenderThread::IdleHandler() { | 533 void RenderThread::IdleHandler() { |
| 532 // It is possible that the timer was set while the widgets were idle, | 534 // It is possible that the timer was set while the widgets were idle, |
| 533 // but that they are no longer idle. If so, just return. | 535 // but that they are no longer idle. If so, just return. |
| 534 if (!widget_count_ || hidden_widget_count_ < widget_count_) | 536 if (!widget_count_ || hidden_widget_count_ < widget_count_) |
| 535 return; | 537 return; |
| 536 | 538 |
| 537 #if defined(OS_WIN) | 539 #if defined(OS_WIN) |
| 538 MallocExtension::instance()->ReleaseFreeMemory(); | 540 MallocExtension::instance()->ReleaseFreeMemory(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 void RenderThread::OnPurgePluginListCache(bool reload_pages) { | 593 void RenderThread::OnPurgePluginListCache(bool reload_pages) { |
| 592 EnsureWebKitInitialized(); | 594 EnsureWebKitInitialized(); |
| 593 // The call below will cause a GetPlugins call with refresh=true, but at this | 595 // The call below will cause a GetPlugins call with refresh=true, but at this |
| 594 // point we already know that the browser has refreshed its list, so disable | 596 // point we already know that the browser has refreshed its list, so disable |
| 595 // refresh temporarily to prevent each renderer process causing the list to be | 597 // refresh temporarily to prevent each renderer process causing the list to be |
| 596 // regenerated. | 598 // regenerated. |
| 597 plugin_refresh_allowed_ = false; | 599 plugin_refresh_allowed_ = false; |
| 598 WebKit::resetPluginCache(reload_pages); | 600 WebKit::resetPluginCache(reload_pages); |
| 599 plugin_refresh_allowed_ = true; | 601 plugin_refresh_allowed_ = true; |
| 600 } | 602 } |
| OLD | NEW |