| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 bool ChromeRenderProcessObserver::OnControlMessageReceived( | 398 bool ChromeRenderProcessObserver::OnControlMessageReceived( |
| 399 const IPC::Message& message) { | 399 const IPC::Message& message) { |
| 400 bool handled = true; | 400 bool handled = true; |
| 401 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) | 401 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) |
| 402 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, | 402 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, |
| 403 OnSetIsIncognitoProcess) | 403 OnSetIsIncognitoProcess) |
| 404 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetDefaultContentSettings, | 404 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetDefaultContentSettings, |
| 405 OnSetDefaultContentSettings) | 405 OnSetDefaultContentSettings) |
| 406 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingsForCurrentURL, | 406 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingsForCurrentURL, |
| 407 OnSetContentSettingsForCurrentURL) | 407 OnSetContentSettingsForCurrentURL) |
| 408 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetImageSettings, |
| 409 OnSetImageSettings) |
| 408 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) | 410 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) |
| 409 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) | 411 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) |
| 410 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) | 412 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) |
| 411 #if defined(USE_TCMALLOC) | 413 #if defined(USE_TCMALLOC) |
| 412 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererTcmalloc, | 414 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetRendererTcmalloc, |
| 413 OnGetRendererTcmalloc) | 415 OnGetRendererTcmalloc) |
| 414 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetTcmallocHeapProfiling, | 416 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetTcmallocHeapProfiling, |
| 415 OnSetTcmallocHeapProfiling) | 417 OnSetTcmallocHeapProfiling) |
| 416 IPC_MESSAGE_HANDLER(ChromeViewMsg_WriteTcmallocHeapProfile, | 418 IPC_MESSAGE_HANDLER(ChromeViewMsg_WriteTcmallocHeapProfile, |
| 417 OnWriteTcmallocHeapProfile) | 419 OnWriteTcmallocHeapProfile) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 439 const ContentSettings& content_settings) { | 441 const ContentSettings& content_settings) { |
| 440 RenderViewContentSettingsSetter setter(url, content_settings); | 442 RenderViewContentSettingsSetter setter(url, content_settings); |
| 441 RenderView::ForEach(&setter); | 443 RenderView::ForEach(&setter); |
| 442 } | 444 } |
| 443 | 445 |
| 444 void ChromeRenderProcessObserver::OnSetDefaultContentSettings( | 446 void ChromeRenderProcessObserver::OnSetDefaultContentSettings( |
| 445 const ContentSettings& content_settings) { | 447 const ContentSettings& content_settings) { |
| 446 ContentSettingsObserver::SetDefaultContentSettings(content_settings); | 448 ContentSettingsObserver::SetDefaultContentSettings(content_settings); |
| 447 } | 449 } |
| 448 | 450 |
| 451 void ChromeRenderProcessObserver::OnSetImageSettings( |
| 452 const ContentSettingRules& rules) { |
| 453 client_->SetImageSettingRules(rules); |
| 454 } |
| 455 |
| 449 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, | 456 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, |
| 450 size_t max_dead_capacity, | 457 size_t max_dead_capacity, |
| 451 size_t capacity) { | 458 size_t capacity) { |
| 452 WebCache::setCapacities( | 459 WebCache::setCapacities( |
| 453 min_dead_capacity, max_dead_capacity, capacity); | 460 min_dead_capacity, max_dead_capacity, capacity); |
| 454 } | 461 } |
| 455 | 462 |
| 456 void ChromeRenderProcessObserver::OnClearCache() { | 463 void ChromeRenderProcessObserver::OnClearCache() { |
| 457 WebCache::clear(); | 464 WebCache::clear(); |
| 458 } | 465 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } | 548 } |
| 542 | 549 |
| 543 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 550 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
| 544 // Tell tcmalloc to release any free pages it's still holding. | 551 // Tell tcmalloc to release any free pages it's still holding. |
| 545 MallocExtension::instance()->ReleaseFreeMemory(); | 552 MallocExtension::instance()->ReleaseFreeMemory(); |
| 546 #endif | 553 #endif |
| 547 | 554 |
| 548 if (client_) | 555 if (client_) |
| 549 client_->OnPurgeMemory(); | 556 client_->OnPurgeMemory(); |
| 550 } | 557 } |
| OLD | NEW |