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