| 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 <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/allocator/allocator_extension.h" | 10 #include "base/allocator/allocator_extension.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) | 329 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) |
| 330 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, | 330 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, |
| 331 OnSetIsIncognitoProcess) | 331 OnSetIsIncognitoProcess) |
| 332 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) | 332 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) |
| 333 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) | 333 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) |
| 334 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) | 334 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) |
| 335 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) | 335 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) |
| 336 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, | 336 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, |
| 337 OnGetCacheResourceStats) | 337 OnGetCacheResourceStats) |
| 338 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) | 338 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) |
| 339 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, | |
| 340 OnSetContentSettingRules) | |
| 341 IPC_MESSAGE_UNHANDLED(handled = false) | 339 IPC_MESSAGE_UNHANDLED(handled = false) |
| 342 IPC_END_MESSAGE_MAP() | 340 IPC_END_MESSAGE_MAP() |
| 343 return handled; | 341 return handled; |
| 344 } | 342 } |
| 345 | 343 |
| 346 void ChromeRenderProcessObserver::WebKitInitialized() { | 344 void ChromeRenderProcessObserver::WebKitInitialized() { |
| 347 webkit_initialized_ = true; | 345 webkit_initialized_ = true; |
| 348 if (pending_cache_capacity_ != kUnitializedCacheCapacity) { | 346 if (pending_cache_capacity_ != kUnitializedCacheCapacity) { |
| 349 WebCache::setCapacities(pending_cache_min_dead_capacity_, | 347 WebCache::setCapacities(pending_cache_min_dead_capacity_, |
| 350 pending_cache_max_dead_capacity_, | 348 pending_cache_max_dead_capacity_, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 367 | 365 |
| 368 void ChromeRenderProcessObserver::OnRenderProcessShutdown() { | 366 void ChromeRenderProcessObserver::OnRenderProcessShutdown() { |
| 369 webkit_initialized_ = false; | 367 webkit_initialized_ = false; |
| 370 } | 368 } |
| 371 | 369 |
| 372 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( | 370 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( |
| 373 bool is_incognito_process) { | 371 bool is_incognito_process) { |
| 374 is_incognito_process_ = is_incognito_process; | 372 is_incognito_process_ = is_incognito_process; |
| 375 } | 373 } |
| 376 | 374 |
| 377 void ChromeRenderProcessObserver::OnSetContentSettingRules( | |
| 378 const RendererContentSettingRules& rules) { | |
| 379 content_setting_rules_ = rules; | |
| 380 } | |
| 381 | |
| 382 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, | 375 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, |
| 383 size_t max_dead_capacity, | 376 size_t max_dead_capacity, |
| 384 size_t capacity) { | 377 size_t capacity) { |
| 385 if (!webkit_initialized_) { | 378 if (!webkit_initialized_) { |
| 386 pending_cache_min_dead_capacity_ = min_dead_capacity; | 379 pending_cache_min_dead_capacity_ = min_dead_capacity; |
| 387 pending_cache_max_dead_capacity_ = max_dead_capacity; | 380 pending_cache_max_dead_capacity_ = max_dead_capacity; |
| 388 pending_cache_capacity_ = capacity; | 381 pending_cache_capacity_ = capacity; |
| 389 return; | 382 return; |
| 390 } | 383 } |
| 391 | 384 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 if (client_) | 443 if (client_) |
| 451 client_->OnPurgeMemory(); | 444 client_->OnPurgeMemory(); |
| 452 } | 445 } |
| 453 | 446 |
| 454 void ChromeRenderProcessObserver::ExecutePendingClearCache() { | 447 void ChromeRenderProcessObserver::ExecutePendingClearCache() { |
| 455 if (clear_cache_pending_ && webkit_initialized_) { | 448 if (clear_cache_pending_ && webkit_initialized_) { |
| 456 clear_cache_pending_ = false; | 449 clear_cache_pending_ = false; |
| 457 WebCache::clear(); | 450 WebCache::clear(); |
| 458 } | 451 } |
| 459 } | 452 } |
| 460 | |
| 461 const RendererContentSettingRules* | |
| 462 ChromeRenderProcessObserver::content_setting_rules() const { | |
| 463 return &content_setting_rules_; | |
| 464 } | |
| OLD | NEW |