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

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

Issue 9694028: Add a Content API around TracingController. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix linux Created 8 years, 9 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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "content/browser/browser_thread_impl.h" 16 #include "content/browser/browser_thread_impl.h"
17 #include "content/browser/download/download_file_manager.h" 17 #include "content/browser/download/download_file_manager.h"
18 #include "content/browser/download/save_file_manager.h" 18 #include "content/browser/download/save_file_manager.h"
19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
20 #include "content/browser/gpu/gpu_process_host.h" 20 #include "content/browser/gpu/gpu_process_host.h"
21 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 21 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
22 #include "content/browser/in_process_webkit/webkit_thread.h" 22 #include "content/browser/in_process_webkit/webkit_thread.h"
23 #include "content/browser/net/browser_online_state_observer.h" 23 #include "content/browser/net/browser_online_state_observer.h"
24 #include "content/browser/plugin_service_impl.h" 24 #include "content/browser/plugin_service_impl.h"
25 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" 25 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
26 #include "content/browser/trace_controller.h" 26 #include "content/browser/trace_controller_impl.h"
27 #include "content/common/hi_res_timer_manager.h" 27 #include "content/common/hi_res_timer_manager.h"
28 #include "content/common/sandbox_policy.h" 28 #include "content/common/sandbox_policy.h"
29 #include "content/public/browser/browser_main_parts.h" 29 #include "content/public/browser/browser_main_parts.h"
30 #include "content/public/browser/browser_shutdown.h" 30 #include "content/public/browser/browser_shutdown.h"
31 #include "content/public/browser/content_browser_client.h" 31 #include "content/public/browser/content_browser_client.h"
32 #include "content/public/browser/render_process_host.h" 32 #include "content/public/browser/render_process_host.h"
33 #include "content/public/common/content_switches.h" 33 #include "content/public/common/content_switches.h"
34 #include "content/public/common/main_function_params.h" 34 #include "content/public/common/main_function_params.h"
35 #include "content/public/common/result_codes.h" 35 #include "content/public/common/result_codes.h"
36 #include "crypto/nss_util.h" 36 #include "crypto/nss_util.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 #if defined(USE_X11) 80 #if defined(USE_X11)
81 #include <X11/Xlib.h> 81 #include <X11/Xlib.h>
82 #endif 82 #endif
83 83
84 // One of the linux specific headers defines this as a macro. 84 // One of the linux specific headers defines this as a macro.
85 #ifdef DestroyAll 85 #ifdef DestroyAll
86 #undef DestroyAll 86 #undef DestroyAll
87 #endif 87 #endif
88 88
89 using content::TraceControllerImpl;
90
89 namespace { 91 namespace {
90 92
91 #if defined(OS_POSIX) && !defined(OS_MACOSX) 93 #if defined(OS_POSIX) && !defined(OS_MACOSX)
92 void SetupSandbox(const CommandLine& parsed_command_line) { 94 void SetupSandbox(const CommandLine& parsed_command_line) {
93 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this 95 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this
94 // code en masse out of chrome_main for now. 96 // code en masse out of chrome_main for now.
95 const char* sandbox_binary = NULL; 97 const char* sandbox_binary = NULL;
96 struct stat st; 98 struct stat st;
97 99
98 // In Chromium branded builds, developers can set an environment variable to 100 // In Chromium branded builds, developers can set an environment variable to
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // Must first NULL pointer or we hit a DCHECK that the newly constructed 318 // Must first NULL pointer or we hit a DCHECK that the newly constructed
317 // message loop is the current one. 319 // message loop is the current one.
318 main_message_loop_.reset(); 320 main_message_loop_.reset();
319 main_message_loop_.reset(parts_->GetMainMessageLoop()); 321 main_message_loop_.reset(parts_->GetMainMessageLoop());
320 if (!main_message_loop_.get()) 322 if (!main_message_loop_.get())
321 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); 323 main_message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI));
322 324
323 InitializeMainThread(); 325 InitializeMainThread();
324 326
325 // Start tracing to a file if needed. 327 // Start tracing to a file if needed.
326 if (base::debug::TraceLog::GetInstance()->IsEnabled()) 328 if (base::debug::TraceLog::GetInstance()->IsEnabled()) {
327 TraceController::GetInstance()->InitStartupTracing(parsed_command_line_); 329 TraceControllerImpl::GetInstance()->InitStartupTracing(
330 parsed_command_line_);
331 }
328 332
329 system_monitor_.reset(new base::SystemMonitor); 333 system_monitor_.reset(new base::SystemMonitor);
330 hi_res_timer_manager_.reset(new HighResolutionTimerManager); 334 hi_res_timer_manager_.reset(new HighResolutionTimerManager);
331 335
332 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 336 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
333 audio_manager_.reset(AudioManager::Create()); 337 audio_manager_.reset(AudioManager::Create());
334 online_state_observer_.reset(new BrowserOnlineStateObserver); 338 online_state_observer_.reset(new BrowserOnlineStateObserver);
335 339
336 #if defined(OS_WIN) 340 #if defined(OS_WIN)
337 system_message_window_.reset(new SystemMessageWindowWin); 341 system_message_window_.reset(new SystemMessageWindowWin);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); 656 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task);
653 657
654 #if defined(OS_MACOSX) 658 #if defined(OS_MACOSX)
655 MessageLoopForUI::current()->Run(); 659 MessageLoopForUI::current()->Run();
656 #else 660 #else
657 MessageLoopForUI::current()->RunWithDispatcher(NULL); 661 MessageLoopForUI::current()->RunWithDispatcher(NULL);
658 #endif 662 #endif
659 } 663 }
660 664
661 } // namespace content 665 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698