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

Side by Side Diff: content/app/content_main_runner.cc

Issue 1468033002: Remove unused memory functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused functions from base/allocator Created 5 years, 1 month 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
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 "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 memset(&sandbox_info_, 0, sizeof(sandbox_info_)); 407 memset(&sandbox_info_, 0, sizeof(sandbox_info_));
408 #endif 408 #endif
409 } 409 }
410 410
411 ~ContentMainRunnerImpl() override { 411 ~ContentMainRunnerImpl() override {
412 if (is_initialized_ && !is_shutdown_) 412 if (is_initialized_ && !is_shutdown_)
413 Shutdown(); 413 Shutdown();
414 } 414 }
415 415
416 #if defined(USE_TCMALLOC) 416 #if defined(USE_TCMALLOC)
417 static bool GetAllocatorWasteSizeThunk(size_t* size) {
418 size_t heap_size, allocated_bytes, unmapped_bytes;
419 MallocExtension* ext = MallocExtension::instance();
420 if (ext->GetNumericProperty("generic.heap_size", &heap_size) &&
421 ext->GetNumericProperty("generic.current_allocated_bytes",
422 &allocated_bytes) &&
423 ext->GetNumericProperty("tcmalloc.pageheap_unmapped_bytes",
424 &unmapped_bytes)) {
425 *size = heap_size - allocated_bytes - unmapped_bytes;
426 return true;
427 }
428 DCHECK(false);
429 return false;
430 }
431
432 static void GetStatsThunk(char* buffer, int buffer_length) { 417 static void GetStatsThunk(char* buffer, int buffer_length) {
433 MallocExtension::instance()->GetStats(buffer, buffer_length); 418 MallocExtension::instance()->GetStats(buffer, buffer_length);
434 } 419 }
435 420
436 static bool GetNumericPropertyThunk(const char* name, size_t* value) { 421 static bool GetNumericPropertyThunk(const char* name, size_t* value) {
437 return MallocExtension::instance()->GetNumericProperty(name, value); 422 return MallocExtension::instance()->GetNumericProperty(name, value);
438 } 423 }
439 424
440 static void ReleaseFreeMemoryThunk() { 425 static void ReleaseFreeMemoryThunk() {
441 MallocExtension::instance()->ReleaseFreeMemory(); 426 MallocExtension::instance()->ReleaseFreeMemory();
(...skipping 22 matching lines...) Expand all
464 // here rather than in process_util_linux.cc with the definition of 449 // here rather than in process_util_linux.cc with the definition of
465 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a 450 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a
466 // dependency on TCMalloc. Really, we ought to have our allocator shim code 451 // dependency on TCMalloc. Really, we ought to have our allocator shim code
467 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. 452 // implement this EnableTerminationOnOutOfMemory() function. Whateverz.
468 // This works for now. 453 // This works for now.
469 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) 454 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
470 // For tcmalloc, we need to tell it to behave like new. 455 // For tcmalloc, we need to tell it to behave like new.
471 tc_set_new_mode(1); 456 tc_set_new_mode(1);
472 457
473 // On windows, we've already set these thunks up in _heap_init() 458 // On windows, we've already set these thunks up in _heap_init()
474 base::allocator::SetGetAllocatorWasteSizeFunction(
475 GetAllocatorWasteSizeThunk);
476 base::allocator::SetGetStatsFunction(GetStatsThunk); 459 base::allocator::SetGetStatsFunction(GetStatsThunk);
477 base::allocator::SetGetNumericPropertyFunction(GetNumericPropertyThunk); 460 base::allocator::SetGetNumericPropertyFunction(GetNumericPropertyThunk);
478 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); 461 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk);
479 462
480 // Provide optional hook for monitoring allocation quantities on a 463 // Provide optional hook for monitoring allocation quantities on a
481 // per-thread basis. Only set the hook if the environment indicates this 464 // per-thread basis. Only set the hook if the environment indicates this
482 // needs to be enabled. 465 // needs to be enabled.
483 const char* profiling = getenv(tracked_objects::kAlternateProfilerTime); 466 const char* profiling = getenv(tracked_objects::kAlternateProfilerTime);
484 if (profiling && 467 if (profiling &&
485 (atoi(profiling) == tracked_objects::TIME_SOURCE_TYPE_TCMALLOC)) { 468 (atoi(profiling) == tracked_objects::TIME_SOURCE_TYPE_TCMALLOC)) {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 850
868 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 851 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
869 }; 852 };
870 853
871 // static 854 // static
872 ContentMainRunner* ContentMainRunner::Create() { 855 ContentMainRunner* ContentMainRunner::Create() {
873 return new ContentMainRunnerImpl(); 856 return new ContentMainRunnerImpl();
874 } 857 }
875 858
876 } // namespace content 859 } // namespace content
OLDNEW
« no previous file with comments | « base/allocator/allocator_extension_thunks.cc ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698