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 "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 "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 memset(&sandbox_info_, 0, sizeof(sandbox_info_)); | 478 memset(&sandbox_info_, 0, sizeof(sandbox_info_)); |
479 #endif | 479 #endif |
480 } | 480 } |
481 | 481 |
482 ~ContentMainRunnerImpl() { | 482 ~ContentMainRunnerImpl() { |
483 if (is_initialized_ && !is_shutdown_) | 483 if (is_initialized_ && !is_shutdown_) |
484 Shutdown(); | 484 Shutdown(); |
485 } | 485 } |
486 | 486 |
487 #if defined(USE_TCMALLOC) | 487 #if defined(USE_TCMALLOC) |
488 static bool GetAllocatorWasteSizeThunk(size_t* size) { | 488 static bool GetAllocatorWasteSizeThunk(size_t* size) { |
489 size_t heap_size, allocated_bytes, unmapped_bytes; | 489 size_t heap_size, allocated_bytes, unmapped_bytes; |
490 MallocExtension* ext = MallocExtension::instance(); | 490 MallocExtension* ext = MallocExtension::instance(); |
491 if (ext->GetNumericProperty("generic.heap_size", &heap_size) && | 491 if (ext->GetNumericProperty("generic.heap_size", &heap_size) && |
492 ext->GetNumericProperty("generic.current_allocated_bytes", | 492 ext->GetNumericProperty("generic.current_allocated_bytes", |
493 &allocated_bytes) && | 493 &allocated_bytes) && |
494 ext->GetNumericProperty("tcmalloc.pageheap_unmapped_bytes", | 494 ext->GetNumericProperty("tcmalloc.pageheap_unmapped_bytes", |
495 &unmapped_bytes)) { | 495 &unmapped_bytes)) { |
496 *size = heap_size - allocated_bytes - unmapped_bytes; | 496 *size = heap_size - allocated_bytes - unmapped_bytes; |
497 return true; | 497 return true; |
| 498 } |
| 499 DCHECK(false); |
| 500 return false; |
498 } | 501 } |
499 DCHECK(false); | |
500 return false; | |
501 } | |
502 | 502 |
503 static void GetStatsThunk(char* buffer, int buffer_length) { | 503 static void GetStatsThunk(char* buffer, int buffer_length) { |
504 MallocExtension::instance()->GetStats(buffer, buffer_length); | 504 MallocExtension::instance()->GetStats(buffer, buffer_length); |
505 } | 505 } |
506 | 506 |
507 static void ReleaseFreeMemoryThunk() { | 507 static void ReleaseFreeMemoryThunk() { |
508 MallocExtension::instance()->ReleaseFreeMemory(); | 508 MallocExtension::instance()->ReleaseFreeMemory(); |
509 } | 509 } |
510 #endif | 510 #endif |
511 | 511 |
512 | |
513 #if defined(OS_WIN) | 512 #if defined(OS_WIN) |
514 virtual int Initialize(HINSTANCE instance, | 513 virtual int Initialize(HINSTANCE instance, |
515 sandbox::SandboxInterfaceInfo* sandbox_info, | 514 sandbox::SandboxInterfaceInfo* sandbox_info, |
516 ContentMainDelegate* delegate) OVERRIDE { | 515 ContentMainDelegate* delegate) OVERRIDE { |
517 // argc/argv are ignored on Windows; see command_line.h for details. | 516 // argc/argv are ignored on Windows; see command_line.h for details. |
518 int argc = 0; | 517 int argc = 0; |
519 char** argv = NULL; | 518 char** argv = NULL; |
520 | 519 |
521 RegisterInvalidParamHandler(); | 520 RegisterInvalidParamHandler(); |
522 _Module.Init(NULL, static_cast<HINSTANCE>(instance)); | 521 _Module.Init(NULL, static_cast<HINSTANCE>(instance)); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 812 |
814 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 813 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
815 }; | 814 }; |
816 | 815 |
817 // static | 816 // static |
818 ContentMainRunner* ContentMainRunner::Create() { | 817 ContentMainRunner* ContentMainRunner::Create() { |
819 return new ContentMainRunnerImpl(); | 818 return new ContentMainRunnerImpl(); |
820 } | 819 } |
821 | 820 |
822 } // namespace content | 821 } // namespace content |
OLD | NEW |