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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 15418002: Record Chrome trace events in tcmalloc heap profiles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 5 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 "content/browser/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:DataFetcher") 467 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:DataFetcher")
468 DataFetcherImplAndroid::Init(base::android::AttachCurrentThread()); 468 DataFetcherImplAndroid::Init(base::android::AttachCurrentThread());
469 } 469 }
470 #endif 470 #endif
471 471
472 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) { 472 if (parsed_command_line_.HasSwitch(switches::kMemoryMetrics)) {
473 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver") 473 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:MemoryObserver")
474 memory_observer_.reset(new MemoryObserver()); 474 memory_observer_.reset(new MemoryObserver());
475 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get()); 475 base::MessageLoop::current()->AddTaskObserver(memory_observer_.get());
476 } 476 }
477
478 trace_memory_controller_.reset(new base::debug::TraceMemoryController(
479 base::MessageLoop::current()->message_loop_proxy()));
477 } 480 }
478 481
479 void BrowserMainLoop::CreateThreads() { 482 void BrowserMainLoop::CreateThreads() {
480 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads") 483 TRACE_EVENT0("startup", "BrowserMainLoop::CreateThreads")
481 484
482 if (parts_) { 485 if (parts_) {
483 TRACE_EVENT0("startup", 486 TRACE_EVENT0("startup",
484 "BrowserMainLoop::CreateThreads:PreCreateThreads"); 487 "BrowserMainLoop::CreateThreads:PreCreateThreads");
485 result_code_ = parts_->PreCreateThreads(); 488 result_code_ = parts_->PreCreateThreads();
486 } 489 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // need to be able to perform IO. 642 // need to be able to perform IO.
640 base::ThreadRestrictions::SetIOAllowed(true); 643 base::ThreadRestrictions::SetIOAllowed(true);
641 BrowserThread::PostTask( 644 BrowserThread::PostTask(
642 BrowserThread::IO, FROM_HERE, 645 BrowserThread::IO, FROM_HERE,
643 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 646 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
644 true)); 647 true));
645 648
646 if (parts_) 649 if (parts_)
647 parts_->PostMainMessageLoopRun(); 650 parts_->PostMainMessageLoopRun();
648 651
652 trace_memory_controller_.reset();
653
649 #if !defined(OS_IOS) 654 #if !defined(OS_IOS)
650 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to 655 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to
651 // delete related objects on the GPU thread. This must be done before 656 // delete related objects on the GPU thread. This must be done before
652 // stopping the GPU thread. The GPU thread will close IPC channels to renderer 657 // stopping the GPU thread. The GPU thread will close IPC channels to renderer
653 // processes so this has to happen before stopping the IO thread. 658 // processes so this has to happen before stopping the IO thread.
654 GpuProcessHostUIShim::DestroyAll(); 659 GpuProcessHostUIShim::DestroyAll();
655 660
656 // Cancel pending requests and prevent new requests. 661 // Cancel pending requests and prevent new requests.
657 if (resource_dispatcher_host_) 662 if (resource_dispatcher_host_)
658 resource_dispatcher_host_.get()->Shutdown(); 663 resource_dispatcher_host_.get()->Shutdown();
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 if (parameters_.ui_task) 936 if (parameters_.ui_task)
932 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 937 base::MessageLoopForUI::current()->PostTask(FROM_HERE,
933 *parameters_.ui_task); 938 *parameters_.ui_task);
934 939
935 base::RunLoop run_loop; 940 base::RunLoop run_loop;
936 run_loop.Run(); 941 run_loop.Run();
937 #endif 942 #endif
938 } 943 }
939 944
940 } // namespace content 945 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698