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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // Currently a busy worker stats are not counted. | 247 // Currently a busy worker stats are not counted. |
248 RenderThread::Get()->Send(new ChromeViewHostMsg_V8HeapStats( | 248 RenderThread::Get()->Send(new ChromeViewHostMsg_V8HeapStats( |
249 total_bytes_, used_bytes_)); | 249 total_bytes_, used_bytes_)); |
250 ++round_id_; | 250 ++round_id_; |
251 } | 251 } |
252 | 252 |
253 } // namespace | 253 } // namespace |
254 | 254 |
255 bool ChromeRenderProcessObserver::is_incognito_process_ = false; | 255 bool ChromeRenderProcessObserver::is_incognito_process_ = false; |
256 | 256 |
257 bool ChromeRenderProcessObserver::extension_activity_log_enabled_ = false; | |
258 | |
259 ChromeRenderProcessObserver::ChromeRenderProcessObserver( | 257 ChromeRenderProcessObserver::ChromeRenderProcessObserver( |
260 chrome::ChromeContentRendererClient* client) | 258 chrome::ChromeContentRendererClient* client) |
261 : client_(client), | 259 : client_(client), |
262 clear_cache_pending_(false), | 260 clear_cache_pending_(false), |
263 webkit_initialized_(false), | 261 webkit_initialized_(false), |
264 pending_cache_min_dead_capacity_(0), | 262 pending_cache_min_dead_capacity_(0), |
265 pending_cache_max_dead_capacity_(0), | 263 pending_cache_max_dead_capacity_(0), |
266 pending_cache_capacity_(kUnitializedCacheCapacity) { | 264 pending_cache_capacity_(kUnitializedCacheCapacity) { |
267 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 265 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
268 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 266 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 317 |
320 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { | 318 ChromeRenderProcessObserver::~ChromeRenderProcessObserver() { |
321 } | 319 } |
322 | 320 |
323 bool ChromeRenderProcessObserver::OnControlMessageReceived( | 321 bool ChromeRenderProcessObserver::OnControlMessageReceived( |
324 const IPC::Message& message) { | 322 const IPC::Message& message) { |
325 bool handled = true; | 323 bool handled = true; |
326 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) | 324 IPC_BEGIN_MESSAGE_MAP(ChromeRenderProcessObserver, message) |
327 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, | 325 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, |
328 OnSetIsIncognitoProcess) | 326 OnSetIsIncognitoProcess) |
329 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetExtensionActivityLogEnabled, | |
330 OnSetExtensionActivityLogEnabled) | |
331 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) | 327 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) |
332 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) | 328 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) |
333 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) | 329 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) |
334 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) | 330 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) |
335 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, | 331 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, |
336 OnGetCacheResourceStats) | 332 OnGetCacheResourceStats) |
337 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) | 333 IPC_MESSAGE_HANDLER(ChromeViewMsg_PurgeMemory, OnPurgeMemory) |
338 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, | 334 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, |
339 OnSetContentSettingRules) | 335 OnSetContentSettingRules) |
340 IPC_MESSAGE_UNHANDLED(handled = false) | 336 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 25 matching lines...) Expand all Loading... |
366 | 362 |
367 void ChromeRenderProcessObserver::OnRenderProcessShutdown() { | 363 void ChromeRenderProcessObserver::OnRenderProcessShutdown() { |
368 webkit_initialized_ = false; | 364 webkit_initialized_ = false; |
369 } | 365 } |
370 | 366 |
371 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( | 367 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( |
372 bool is_incognito_process) { | 368 bool is_incognito_process) { |
373 is_incognito_process_ = is_incognito_process; | 369 is_incognito_process_ = is_incognito_process; |
374 } | 370 } |
375 | 371 |
376 void ChromeRenderProcessObserver::OnSetExtensionActivityLogEnabled( | |
377 bool extension_activity_log_enabled) { | |
378 extension_activity_log_enabled_ = extension_activity_log_enabled; | |
379 } | |
380 | |
381 void ChromeRenderProcessObserver::OnSetContentSettingRules( | 372 void ChromeRenderProcessObserver::OnSetContentSettingRules( |
382 const RendererContentSettingRules& rules) { | 373 const RendererContentSettingRules& rules) { |
383 content_setting_rules_ = rules; | 374 content_setting_rules_ = rules; |
384 } | 375 } |
385 | 376 |
386 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, | 377 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, |
387 size_t max_dead_capacity, | 378 size_t max_dead_capacity, |
388 size_t capacity) { | 379 size_t capacity) { |
389 if (!webkit_initialized_) { | 380 if (!webkit_initialized_) { |
390 pending_cache_min_dead_capacity_ = min_dead_capacity; | 381 pending_cache_min_dead_capacity_ = min_dead_capacity; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 if (clear_cache_pending_ && webkit_initialized_) { | 450 if (clear_cache_pending_ && webkit_initialized_) { |
460 clear_cache_pending_ = false; | 451 clear_cache_pending_ = false; |
461 WebCache::clear(); | 452 WebCache::clear(); |
462 } | 453 } |
463 } | 454 } |
464 | 455 |
465 const RendererContentSettingRules* | 456 const RendererContentSettingRules* |
466 ChromeRenderProcessObserver::content_setting_rules() const { | 457 ChromeRenderProcessObserver::content_setting_rules() const { |
467 return &content_setting_rules_; | 458 return &content_setting_rules_; |
468 } | 459 } |
OLD | NEW |