| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_extension.h" | 7 #include "base/allocator/allocator_extension.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 OnSetTcmallocHeapProfiling) | 225 OnSetTcmallocHeapProfiling) |
| 226 IPC_MESSAGE_HANDLER(ChromeViewMsg_WriteTcmallocHeapProfile, | 226 IPC_MESSAGE_HANDLER(ChromeViewMsg_WriteTcmallocHeapProfile, |
| 227 OnWriteTcmallocHeapProfile) | 227 OnWriteTcmallocHeapProfile) |
| 228 #endif | 228 #endif |
| 229 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) | 229 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) |
| 230 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, | 230 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, |
| 231 OnGetCacheResourceStats) | 231 OnGetCacheResourceStats) |
| 232 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) | 232 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) |
| 233 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, | 233 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, |
| 234 OnSetContentSettingRules) | 234 OnSetContentSettingRules) |
| 235 IPC_MESSAGE_HANDLER(ChromeViewMsg_ToggleWebKitSharedTimer, |
| 236 OnToggleWebKitSharedTimer) |
| 235 IPC_MESSAGE_UNHANDLED(handled = false) | 237 IPC_MESSAGE_UNHANDLED(handled = false) |
| 236 IPC_END_MESSAGE_MAP() | 238 IPC_END_MESSAGE_MAP() |
| 237 return handled; | 239 return handled; |
| 238 } | 240 } |
| 239 | 241 |
| 240 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( | 242 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( |
| 241 bool is_incognito_process) { | 243 bool is_incognito_process) { |
| 242 is_incognito_process_ = is_incognito_process; | 244 is_incognito_process_ = is_incognito_process; |
| 243 #if defined(OS_ANDROID) | 245 #if defined(OS_ANDROID) |
| 244 webkit_media::WebMediaPlayerAndroid::InitIncognito(is_incognito_process_); | 246 webkit_media::WebMediaPlayerAndroid::InitIncognito(is_incognito_process_); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 experiments_helper::SetChildProcessLoggingExperimentList(); | 314 experiments_helper::SetChildProcessLoggingExperimentList(); |
| 313 } | 315 } |
| 314 | 316 |
| 315 void ChromeRenderProcessObserver::OnGetV8HeapStats() { | 317 void ChromeRenderProcessObserver::OnGetV8HeapStats() { |
| 316 v8::HeapStatistics heap_stats; | 318 v8::HeapStatistics heap_stats; |
| 317 v8::V8::GetHeapStatistics(&heap_stats); | 319 v8::V8::GetHeapStatistics(&heap_stats); |
| 318 RenderThread::Get()->Send(new ChromeViewHostMsg_V8HeapStats( | 320 RenderThread::Get()->Send(new ChromeViewHostMsg_V8HeapStats( |
| 319 heap_stats.total_heap_size(), heap_stats.used_heap_size())); | 321 heap_stats.total_heap_size(), heap_stats.used_heap_size())); |
| 320 } | 322 } |
| 321 | 323 |
| 324 void ChromeRenderProcessObserver::OnToggleWebKitSharedTimer(bool suspend) { |
| 325 RenderThread::Get()->ToggleWebKitSharedTimer(suspend); |
| 326 } |
| 327 |
| 322 void ChromeRenderProcessObserver::OnPurgeMemory() { | 328 void ChromeRenderProcessObserver::OnPurgeMemory() { |
| 323 RenderThread::Get()->EnsureWebKitInitialized(); | 329 RenderThread::Get()->EnsureWebKitInitialized(); |
| 324 | 330 |
| 325 // Clear the object cache (as much as possible; some live objects cannot be | 331 // Clear the object cache (as much as possible; some live objects cannot be |
| 326 // freed). | 332 // freed). |
| 327 WebCache::clear(); | 333 WebCache::clear(); |
| 328 | 334 |
| 329 // Clear the font/glyph cache. | 335 // Clear the font/glyph cache. |
| 330 WebFontCache::clear(); | 336 WebFontCache::clear(); |
| 331 | 337 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 350 if (clear_cache_pending_) { | 356 if (clear_cache_pending_) { |
| 351 clear_cache_pending_ = false; | 357 clear_cache_pending_ = false; |
| 352 WebCache::clear(); | 358 WebCache::clear(); |
| 353 } | 359 } |
| 354 } | 360 } |
| 355 | 361 |
| 356 const RendererContentSettingRules* | 362 const RendererContentSettingRules* |
| 357 ChromeRenderProcessObserver::content_setting_rules() const { | 363 ChromeRenderProcessObserver::content_setting_rules() const { |
| 358 return &content_setting_rules_; | 364 return &content_setting_rules_; |
| 359 } | 365 } |
| OLD | NEW |