Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: chrome/renderer/chrome_render_process_observer.cc

Issue 289863005: [Mac] Maximise timer slack for background tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial review Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/message_loop/timer_slack.h"
16 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
17 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
18 #include "base/metrics/statistics_recorder.h" 19 #include "base/metrics/statistics_recorder.h"
19 #include "base/native_library.h" 20 #include "base/native_library.h"
20 #include "base/path_service.h" 21 #include "base/path_service.h"
21 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
22 #include "base/threading/platform_thread.h" 23 #include "base/threading/platform_thread.h"
23 #include "chrome/common/child_process_logging.h" 24 #include "chrome/common/child_process_logging.h"
24 #include "chrome/common/chrome_paths.h" 25 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess, 307 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsIncognitoProcess,
307 OnSetIsIncognitoProcess) 308 OnSetIsIncognitoProcess)
308 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities) 309 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCacheCapacities, OnSetCacheCapacities)
309 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache) 310 IPC_MESSAGE_HANDLER(ChromeViewMsg_ClearCache, OnClearCache)
310 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup) 311 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetFieldTrialGroup, OnSetFieldTrialGroup)
311 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats) 312 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetV8HeapStats, OnGetV8HeapStats)
312 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats, 313 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetCacheResourceStats,
313 OnGetCacheResourceStats) 314 OnGetCacheResourceStats)
314 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules, 315 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetContentSettingRules,
315 OnSetContentSettingRules) 316 OnSetContentSettingRules)
317 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetCoalesceTimers,
318 OnSetTimerCoalescing)
316 IPC_MESSAGE_UNHANDLED(handled = false) 319 IPC_MESSAGE_UNHANDLED(handled = false)
317 IPC_END_MESSAGE_MAP() 320 IPC_END_MESSAGE_MAP()
318 return handled; 321 return handled;
319 } 322 }
320 323
321 void ChromeRenderProcessObserver::WebKitInitialized() { 324 void ChromeRenderProcessObserver::WebKitInitialized() {
322 webkit_initialized_ = true; 325 webkit_initialized_ = true;
323 if (pending_cache_capacity_ != kUnitializedCacheCapacity) { 326 if (pending_cache_capacity_ != kUnitializedCacheCapacity) {
324 WebCache::setCapacities(pending_cache_min_dead_capacity_, 327 WebCache::setCapacities(pending_cache_min_dead_capacity_,
325 pending_cache_max_dead_capacity_, 328 pending_cache_max_dead_capacity_,
(...skipping 21 matching lines...) Expand all
347 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess( 350 void ChromeRenderProcessObserver::OnSetIsIncognitoProcess(
348 bool is_incognito_process) { 351 bool is_incognito_process) {
349 is_incognito_process_ = is_incognito_process; 352 is_incognito_process_ = is_incognito_process;
350 } 353 }
351 354
352 void ChromeRenderProcessObserver::OnSetContentSettingRules( 355 void ChromeRenderProcessObserver::OnSetContentSettingRules(
353 const RendererContentSettingRules& rules) { 356 const RendererContentSettingRules& rules) {
354 content_setting_rules_ = rules; 357 content_setting_rules_ = rules;
355 } 358 }
356 359
360 void ChromeRenderProcessObserver::OnSetTimerCoalescing(bool enabled) {
361 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
362 if (enabled)
363 timer_slack = base::TIMER_SLACK_MAXIMUM;
364 base::SetTimerSlack(timer_slack);
365 }
366
357 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity, 367 void ChromeRenderProcessObserver::OnSetCacheCapacities(size_t min_dead_capacity,
358 size_t max_dead_capacity, 368 size_t max_dead_capacity,
359 size_t capacity) { 369 size_t capacity) {
360 if (!webkit_initialized_) { 370 if (!webkit_initialized_) {
361 pending_cache_min_dead_capacity_ = min_dead_capacity; 371 pending_cache_min_dead_capacity_ = min_dead_capacity;
362 pending_cache_max_dead_capacity_ = max_dead_capacity; 372 pending_cache_max_dead_capacity_ = max_dead_capacity;
363 pending_cache_capacity_ = capacity; 373 pending_cache_capacity_ = capacity;
364 return; 374 return;
365 } 375 }
366 376
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (clear_cache_pending_ && webkit_initialized_) { 414 if (clear_cache_pending_ && webkit_initialized_) {
405 clear_cache_pending_ = false; 415 clear_cache_pending_ = false;
406 WebCache::clear(); 416 WebCache::clear();
407 } 417 }
408 } 418 }
409 419
410 const RendererContentSettingRules* 420 const RendererContentSettingRules*
411 ChromeRenderProcessObserver::content_setting_rules() const { 421 ChromeRenderProcessObserver::content_setting_rules() const {
412 return &content_setting_rules_; 422 return &content_setting_rules_;
413 } 423 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698